trend and r2

praise praise praise_city1 at HOTMAIL.COM
Wed Nov 15 08:37:18 EST 2006


Dear Grads users,

I know that the Trends or Slopes of a field can be computed as follows
(extracted from GRADSUSR archives).
However, how can I modify to find out the r^2 (ie to determine the
significance of the trend or slope)?
Thanks

MC
=====================================================================
'open file'
 'set lon 88'
 'set lat 0'
 'set t 1 24' * assuming this is the time limit
*** 'define yvar = aave(...)'

 'd yvar'

* make a variable 1, 2, ..., 24 to calculate m and c of y = mx + c
 'xvar = yvar*0 + 1'
 'xvar = const(xvar,1,-u)'
 'xvar = 25 - sum(xvar,t+0,t=24)'

 'set t 1'

 'define p = sum(xvar,t=1,t=24)'
 'define q = sum(yvar,t=1,t=24)'
 'define r = sum(xvar*yvar,t=1,t=24)'
 'define s = sum(xvar*xvar,t=1,t=24)'

 'define rn = ave(xvar*yvar,t=1,t=24)'
 'define n = r/rn'
* amp is the slope or trend
 'define amp =  (n*r - p*q)/(n*s - p*p)' * this is m
 'define ave = (q - amp*p)/n' * this is c
==================================================

_________________________________________________________________
MSN Tool Bar 幫你刪除惱人的廣告 ! http://toolbar.msn.com.hk



More information about the gradsusr mailing list