[GRASS-dev] r.regression.multi failing

Markus Metz markus.metz.giswork at gmail.com
Wed Mar 23 08:57:39 PDT 2016


On Wed, Mar 23, 2016 at 4:43 PM, Paulo van Breugel
<p.vanbreugel at gmail.com> wrote:
>
>
> On 23-03-16 16:21, Moritz Lennert wrote:
>>
>> Le Wed, 23 Mar 2016 15:55:40 +0100,
>> Paulo van Breugel <p.vanbreugel at gmail.com> a écrit :
>>
>>> On 23-03-16 15:24, Anna Petrášová wrote:
>>>>
>>>> On Wed, Mar 23, 2016 at 10:01 AM, Luca Delucchi
>>>> <lucadeluge at gmail.com> wrote:
>>>>>
>>>>> On 23 March 2016 at 14:31, Paulo van Breugel
>>>>> <p.vanbreugel at gmail.com> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>>>
>>>>>> I am using r.regression.multi in a python script (using
>>>>>> grass.run_command()) to compute the variance inflation factor
>>>>>> (VIF).  It runs in a loop, regressing variables one by one to all
>>>>>> the other variables. It sometimes happen that the function fails
>>>>>> with:
>>>>>>
>>>>>> WARNING: Matrix is unsolvable
>>>>>> ERROR: Multiple regression failed
>>
>> This looks like a clear bug for me. So, even if I understand that you
>> need to work around it for now, could you also post a bug report with a
>> reproductible example ?
>
> Not sure it is a bug? It happens when amongst the independent variables
> there are perfectly correlated variables. The message "WARNING: Matrix is
> unsolvable" therefore seems correct to me.

Yes, this warning should only occur in case of colinearity

> Now this is treated as an error
> (ERROR: Multiple regression failed"), which I guess is the equivalent of
> grass.error() in a python script? Perhaps it would be possible to provide a
> warning instead, and give an output that can be captured, like NA for the
> coefficient estimates, instead of breaking of the function?

Instead of grass.run_command(), you can use

ps = grass.start_command()
returncode = ps.wait()

returncode is zero if the module finished successfully, non-zero if an
error occurred, easy to capture in a script.

Markus M


More information about the grass-dev mailing list