[R] Orthogonal Polynomial Regression Parameter Estimation
WilD KID
wildscop at yahoo.com
Fri May 7 03:43:01 CEST 2004
Dear all,
I came up with some sort of solution(!), which is :
--------------------------------------------
> orth.fit<-lm(Y~poly(X,degree = 6))
> co<-coef(orth.fit)
> s<-c(sum(p0^2), sum(p1^2), sum(p2^2), sum(p3^2),
sum(p4^2), sum(p5^2), sum(p6^2)) # these pi's were
previously defined
> nor<-co/sqrt(ss)
>
co1<-c(alpha0,alpha1,alpha2,alpha3,alpha4,alpha5,alpha6)
# from previous results
> cbind(co,ss,nor,co1)
co ss nor
co1
(Intercept) 1.285000000 8 0.4543161069
1.2850000000
poly(X, degree = 6)1 0.529260490 168 0.0408333333
0.0408333333
poly(X, degree = 6)2 -0.316321867 168 -0.0244047619
-0.0244047619
poly(X, degree = 6)3 -0.221564684 264 -0.0136363636
-0.0136363636
poly(X, degree = 6)4 0.054795962 616 0.0022077922
0.0022077922
poly(X, degree = 6)5 0.062910192 2184 0.0013461538
0.0013461538
poly(X, degree = 6)6 0.006154575 264 0.0003787879
0.0003787879
--------------------------------------------
Note that all values of "nor" (modified R result) and
"co1" (Draper and Smith result) matches, except the
intercept term! But i guess i can live with it:p
However, if any one has any more suggestions, please
let me know.
Thanks to all who helped me here (Douglas Bates and
Prof Brian Ripley) and elsewhere (including Dale
McLerran of comp.soft-sys.sas and Nick Cox of Stata
list).
Thank you very much for all your support.
_______________________
Mohammad Ehsanul Karim <wildscop at yahoo.com>
Institute of Statistical Research and Training
University of Dhaka, Dhaka- 1000, Bangladesh
More information about the R-help
mailing list