[GRASS-user] Linear regression between 2 rasters (old and new)

I

I have been using r.series to calculate a linear regression slope for an old and new raster map using r.series. But now I need to also obtain the error. It seems not to be possible to use r.series. Is this true? if yes, what alternative do I have?
THanks
Antonio

__________ Information from ESET NOD32 Antivirus, version of virus signature database 6506 (20110930) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Dear Antonio,

Depending on your raster sizes you can load both maps into R and
compute the stats over there.

best

miltinho

2011/9/30, António Rocha <antonio.rocha@deimos.com.pt>:

I

I have been using r.series to calculate a linear regression slope for an
old and new raster map using r.series. But now I need to also obtain the
error. It seems not to be possible to use r.series. Is this true? if
yes, what alternative do I have?
THanks
Antonio

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 6506 (20110930) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--

Miltinho - mcr@rc.unesp.br
Laboratório de Ecologia Espacial e Conservação - LEEC
Depto de Ecologia - UNESP - Rio Claro
Av. 24A, 1515- Bela Vista
13506-900 Rio Claro, SP, Brasil

http://www.rc.unesp.br/ib/ecologia/
Fone: +55 19 3526-9647
Cel: 19 9853-3220 / 19 9853-5430

Or use python + numpy

check the wiki for python + GRASS.

best

Carlos

2011/9/30 Milton Cezar Ribeiro <miltinho.astronauta@gmail.com>

Dear Antonio,

Depending on your raster sizes you can load both maps into R and
compute the stats over there.

best

miltinho

2011/9/30, António Rocha <antonio.rocha@deimos.com.pt>:

I

I have been using r.series to calculate a linear regression slope for an
old and new raster map using r.series. But now I need to also obtain the
error. It seems not to be possible to use r.series. Is this true? if
yes, what alternative do I have?
THanks
Antonio

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 6506 (20110930) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Miltinho - mcr@rc.unesp.br
Laboratório de Ecologia Espacial e Conservação - LEEC
Depto de Ecologia - UNESP - Rio Claro
Av. 24A, 1515- Bela Vista
13506-900 Rio Claro, SP, Brasil

http://www.rc.unesp.br/ib/ecologia/
Fone: +55 19 3526-9647
Cel: 19 9853-3220 / 19 9853-5430


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil

http://www.igc.usp.br/pessoais/guano
http://digitalelevation.wordpress.com/
http://lattes.cnpq.br/5846052449613692 (CV)

Twitter: @CarlosGrohmann
http://carlosgrohmann.tumblr.com/
Linux User #89721


Can’t stop the signal.

On 30/09/11 16:39, António Rocha wrote:

I

I have been using r.series to calculate a linear regression slope for an
old and new raster map using r.series. But now I need to also obtain the
error. It seems not to be possible to use r.series. Is this true? if
yes, what alternative do I have?

If by error you mean the error in each pixel, you can use the slope and offset values r.series gives you in r.mapcalc to calculate the theoretical value based on the linear equation and then again r.mapcalc to calculate the difference between the theoretical and the actual value.

Also check out r.regression.line.

Moritz

2011/9/30 António Rocha <antonio.rocha@deimos.com.pt>:

I

I have been using r.series to calculate a linear regression slope for an old
and new raster map using r.series. But now I need to also obtain the error.
It seems not to be possible to use r.series. Is this true? if yes, what
alternative do I have?

In your case, the error is always zero. This is because the regression
equation is based on only two maps.

Just for clarification, r.series does not calculate a linear
regression between raster maps. r.series can calculate a linear
regression between raster values and the order number of raster maps,
and this is done for each cell separately. For example, with 4 input
maps map1,map2,map3,map4, r.series calculates the regression
coefficients for each cell for x = (1, 2, 3, 4) and y = (value of map1
and current cell, value of map2 and current cell, value of map3 and
current cell, value of map4 and current cell). The general form of a
linear regression is

y = b0 + b1 * x1 + b2 * x2 + ... + bn * xn + error

with n = number of explaining variables

With only one explaining variable, this reduces to

y = b0 + b1 * x1 + error

with b0 = offset, b1 = slope

With only two values available for x and y, this reduces to

y = b0 + b1 * x1

i.e. no error, the regression line passes exactly through the two given points.

In your case, there are only two points per cell, the first point is
(1, value of map1 at current cell), the second point is (2, value of
map2 at current cell).

The regression coefficients of r.series are interesting for time
series maps to detect trends in time, e.g. correlating temperature
with time (implied by the order of the input maps).

r.regression.line calculates regression coefficients between two
raster maps which is something completely different.

Markus M