[GRASSLIST:5813] linear regression of 2 rasters

Hi everyone,

Is there any simple way in GRASS to do a linear regression of 2 raster files,
or would I need to first subsample with vector points?

Or- is there anyway to do this in gnuplot / R.

I have found that R is not behaving like it used to, when used with GRASS54...

Any ideas?
--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

On Wed, 16 Feb 2005, Dylan Beaudette wrote:

Hi everyone,

Is there any simple way in GRASS to do a linear regression of 2 raster files,
or would I need to first subsample with vector points?

Or- is there anyway to do this in gnuplot / R.

I have found that R is not behaving like it used to, when used with GRASS54...

See the STATGRASS mailing list. The switch to the 3D WINDOW means that
regular service is currently only supported for GRASS up to and including
5.4. The work-around is to use interp=TRUE in gmeta() and perhaps
elsewhere, because the compiled code in the R/GRASS interface only works
with 2D WINDOWs, and there is nothing to condition against in 6.0.0beta
(there will be an environment variable in 6.0.0 when it comes). If the
interpreted interface is good enough (exchanging ASCII files), 6.0.0beta
may work.

Once 6.0.0 stabilises, a fresh version of the interface will appear. If
people want to help, I'll put it on sourceforge and give developer write
access if that would help. It isn't obvious how to do this right, because
it is a contributed package to both R and GRASS, so has to suit build
trains and constraints across platforms, and keep working for 5.* users.

Roger

Any ideas?

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand@nhh.no

Thanks for the info Roger.

Since most of my analysis deals with raster data, GRASS54 will work.

By default my locale is set to UTF-8... R was a little upset about this. The
history and arrow keys were not functioning (control sequences were appearing
instead of a previous entry, or moving the cursor to the left or right)... I
tried setting all locale-related variables to C, and re-running R. R no
longer complained, but the history and arrow keys still do not work.

here is a sample of what appears on the screen when i press one of the arrow
keys:
^[[A^[[D^[[C (up, left, right)

Any ideas?

On Wednesday 16 February 2005 12:16 pm, Roger Bivand wrote:

On Wed, 16 Feb 2005, Dylan Beaudette wrote:
> Hi everyone,
>
> Is there any simple way in GRASS to do a linear regression of 2 raster
> files, or would I need to first subsample with vector points?
>
> Or- is there anyway to do this in gnuplot / R.
>
> I have found that R is not behaving like it used to, when used with
> GRASS54...

See the STATGRASS mailing list. The switch to the 3D WINDOW means that
regular service is currently only supported for GRASS up to and including
5.4. The work-around is to use interp=TRUE in gmeta() and perhaps
elsewhere, because the compiled code in the R/GRASS interface only works
with 2D WINDOWs, and there is nothing to condition against in 6.0.0beta
(there will be an environment variable in 6.0.0 when it comes). If the
interpreted interface is good enough (exchanging ASCII files), 6.0.0beta
may work.

Once 6.0.0 stabilises, a fresh version of the interface will appear. If
people want to help, I'll put it on sourceforge and give developer write
access if that would help. It isn't obvious how to do this right, because
it is a contributed package to both R and GRASS, so has to suit build
trains and constraints across platforms, and keep working for 5.* users.

Roger

> Any ideas?

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

Is there any simple way in GRASS to do a linear regression of 2 raster
files, or would I need to first subsample with vector points?

GRASS 6.0beta2 > r.regression.line --help

Description:
Calculates linear regression from two raster maps: y = a + b*x

Usage:
r.regression.line map1=name map2=name [output=name]

Parameters:
    map1 Map for x coefficient
    map2 Map for y coefficient
  output ASCII file for storing regression coefficients (output to
           screen if file not specified).

or maybe r.covar?

Hamish