trend and r2

Jiande Wang jiande at ATMOS.UMD.EDU
Wed Nov 15 13:32:43 EST 2006


Hi,
   I just felt it strange on the script: "xvar = yvar*0 + 1", why time it 
with a zero? is it a typo?

Thanks.
Jiande


  2006, praise praise wrote:

> 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