<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 23, 2016 at 4:57 PM, Markus Metz <span dir="ltr"><<a href="mailto:markus.metz.giswork@gmail.com" target="_blank">markus.metz.giswork@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Mar 23, 2016 at 4:43 PM, Paulo van Breugel<br>
<span class=""><<a href="mailto:p.vanbreugel@gmail.com">p.vanbreugel@gmail.com</a>> wrote:<br>
><br>
><br>
> On 23-03-16 16:21, Moritz Lennert wrote:<br>
>><br>
>> Le Wed, 23 Mar 2016 15:55:40 +0100,<br>
>> Paulo van Breugel <<a href="mailto:p.vanbreugel@gmail.com">p.vanbreugel@gmail.com</a>> a écrit :<br>
>><br>
>>> On 23-03-16 15:24, Anna Petrášová wrote:<br>
>>>><br>
>>>> On Wed, Mar 23, 2016 at 10:01 AM, Luca Delucchi<br>
>>>> <<a href="mailto:lucadeluge@gmail.com">lucadeluge@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> On 23 March 2016 at 14:31, Paulo van Breugel<br>
>>>>> <<a href="mailto:p.vanbreugel@gmail.com">p.vanbreugel@gmail.com</a>> wrote:<br>
>>>>>><br>
>>>>>> Hi,<br>
>>>>>><br>
>>>>><br>
>>>>> Hi,<br>
>>>>><br>
>>>>>><br>
>>>>>> I am using r.regression.multi in a python script (using<br>
>>>>>> grass.run_command()) to compute the variance inflation factor<br>
>>>>>> (VIF).  It runs in a loop, regressing variables one by one to all<br>
>>>>>> the other variables. It sometimes happen that the function fails<br>
>>>>>> with:<br>
>>>>>><br>
>>>>>> WARNING: Matrix is unsolvable<br>
>>>>>> ERROR: Multiple regression failed<br>
>><br>
>> This looks like a clear bug for me. So, even if I understand that you<br>
>> need to work around it for now, could you also post a bug report with a<br>
>> reproductible example ?<br>
><br>
> Not sure it is a bug? It happens when amongst the independent variables<br>
> there are perfectly correlated variables. The message "WARNING: Matrix is<br>
> unsolvable" therefore seems correct to me.<br>
<br>
</span>Yes, this warning should only occur in case of colinearity<br>
<span class=""><br>
> Now this is treated as an error<br>
> (ERROR: Multiple regression failed"), which I guess is the equivalent of<br>
> grass.error() in a python script? Perhaps it would be possible to provide a<br>
> warning instead, and give an output that can be captured, like NA for the<br>
> coefficient estimates, instead of breaking of the function?<br>
<br>
</span>Instead of grass.run_command(), you can use<br>
<br>
ps = grass.start_command()<br>
returncode = ps.wait()<br>
<br>
returncode is zero if the module finished successfully, non-zero if an<br>
error occurred, easy to capture in a script.<br></blockquote><div><br></div><div>OK, thanks<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Markus M<br>
</blockquote></div><br></div></div>