[GRASS-user] Calculate p value for regression slope in r.series

Glynn Clements glynn at gclements.plus.com
Fri Nov 9 03:28:38 PST 2012


Markus Metz wrote:

> >> Just wondering, if it is implemented in r.regression.series, would it be
> >> very difficult to port to r.series? Or do the two things function different
> >> internally?
> >
> > It could probably be added to r.series quite quickly if someone was
> > willing to provide definitions for "t-value" and "p-value".
> 
> The t-value of a simple linear regression can be calculate with
> 
> t = sqrt(Rsq) * sqrt((n - 2) / (1 - Rsq));
> 
> Rsq = R squared or coefficient of determination (r.series method=detcoeff)
> n = sample size

In which case, it can be calculated with e.g.

	r.series ... output=tmp.rsq,tmp.n method=detcoeff,count
	r.mapcalc 'outmap = sqrt(tmp.rsq * (tmp.n - 2) / (1 - tmp.rsq))'

I've added method=tvalue in r53742.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list