GRASS logo


r.regression.series - Makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers.


raster, statistics, series, regression


r.regression.series --help
r.regression.series [-n] xseries=name[,name,...] yseries=name[,name,...] output=name[,name,...] method=string[,string,...] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Propagate NULLs
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


xseries=name[,name,...] [required]
Name of input raster map(s)
yseries=name[,name,...] [required]
Name of input raster map(s)
output=name[,name,...] [required]
Name for output raster map
method=string[,string,...] [required]
Regression parameters
Options: slope, offset, corcoef, rsq, adjrsq, f, t

Table of contents


r.regression.series is a module to calculate linear regression parameters between two time series, e.g. NDVI and precipitation.

The module makes each output cell value a function of the values assigned to the corresponding cells in the two input raster map series. Following methods are available:


The module assumes a simple linear regression of the form
    y = a + b * x

offset is equivalent to a in the above equation, also referred to as constant or intercept.

slope is equivalent to b in the above equation.

corcoef is the correlation coefficient R with a theoretical range of -1,1.

rsq is the coefficient of determination, equivalent to the squared correlation coefficient R2.

adjrsq is the coefficient of determination adjusted for the number of samples, i.e. number of input maps per series.

f is the value of the F statistic.

t is the value of the T statistic.


The number of maps in xseries and yseries must be identical.

With -n flag, any cell for which any of the corresponding input cells are NULL is automatically set to NULL (NULL propagation). The aggregate function is not called, so all methods behave this way with respect to the -n flag.

Without -n flag, the complete list of inputs for each cell (including NULLs) is passed to the function. Individual functions can handle data as they choose. Mostly, they just compute the parameter over the non-NULL values, producing a NULL result only if all inputs are NULL.

Linear regression (slope, offset, coefficient of determination) requires an equal number of xseries and yseries maps. If the different time series have irregular time intervals, NULL raster maps can be inserted into time series to make time intervals equal (see example).

The maximum number of raster maps to be processed is limited by the operating system. For example, both the hard and soft limits are typically 1024. The soft limit can be changed with e.g. ulimit -n 1500 (UNIX-based operating systems) but not higher than the hard limit. If it is too low, you can as superuser add an entry in

# <domain>      <type>  <item>         <value>
your_username  hard    nofile          1500
This would raise the hard limit to 1500 file. Be warned that more files open need more RAM.


Using r.regression.series with wildcards:
r.regression.series xseries="`g.list pattern='insitu_data.*' sep=,`" \
	 yseries="`g.list pattern='invivo_data.*' sep=,`" \
         output=insitu_data.rsquared method=rsq

Note the g.list module also supports regular expressions for selecting map names.

Example for multiple parameters to be computed in one run (3 resulting parameters from 8 input maps, 4 maps per time series):

r.regression.series x=xone,xtwo,xthree,xfour y=yone,ytwo,ythree,yfour \
    out=res_offset,res_slope,res_adjrsq meth=offset,slope,adjrsq


g.list, g.region, r.series, r.regression.line, r.regression.multi


Markus Metz


Available at: r.regression.series source code (history)

Latest change: Monday Jan 30 19:52:26 2023 in commit: cac8d9d848299297977d1315b7e90cc3f7698730

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual