>
>Hello. Does anyone know a function or script for performing
>a multiple regression with NCL?
>If I have time series of vegetation, T, and precip, I wanted to
>create an equation:
>
>vegetation = a1*T + a2*pcp +... (a1 and a2 are coefficients)
To all.
I provided Mike with a fortran subroutine to perform
the multiple linear regression. Hopefully,
this will be made available in the next release of NCL [v032].
If anyone wants to use this now, I can send the fotran code.
It is implemented as follows
[1] WRAPIT zregr_ncl.f
[2] external MLR "./zregr_ncl.so"
[3] let N be the number of, say, time pts
M number of variables
X(N) is the dependent variable
Y = new ((/M,N/), typeof(X), 1.e20) ; independent variables
Y(0,:) = A ; T is of length N
Y(1,:) = B ; B N
etc
C = new ( M, typeof(X) ) ; coefficients
RESID = new ( N, typeof(X) )
MLR::ZREGR1(N,M,X,X@_FillValue,Y,Y@_FillValue,C,RESID)
print(C) ; desired coef
print(RESID) ; residuals [=X-XMLR]
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Wed Aug 18 2004 - 15:09:57 MDT