[R] convert princomp output to equation for plane?

Mark Difford mark_difford at yahoo.co.uk
Thu Aug 28 11:45:00 CEST 2008


Hi Bill,

>> Since x, y,and z all have measurement errors attached, the proper way 
>> to do the fit is with principal components analysis, and to use the 
>> first component (called loadings in princomp output).

The easiest way for you to do this is to use the pcr [principal component
regression] function in the pls package. Be aware that unless you fit all
components you will be carrying out a form of penalized regression. A small
example follows (assumes that you have installed the pls package):

##
lm.mod <- lm(Ozone ~ Solar.R + Wind + Month, data=airquality)
pc.mod <- pcr(Ozone ~ Solar.R + Wind + Month, data=airquality)

lm.mod
coef(pc.mod, intercept = TRUE)
coef(pc.mod, ncomp=1, intercept = TRUE)
coef(pc.mod, ncomp=3, intercept = TRUE)

Regards, Mark.


William Simpson-2 wrote:
> 
> I want to fit something like:
> z = b0 + b1*x + b2*y
> 
> Since x, y,and z all have measurement errors attached, the proper way
> to do the fit is with principal components analysis, and to use the
> first component (called loadings in princomp output).
> 
> My dumb question is: how do I convert the princomp output to equation
> coefficients in the format above?
> 
> I guess another dumb question would be: how about getting the standard
> deviations of b0, b1, b2?
> 
> Thanks very much for any help.
> 
> Bill
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/convert-princomp-output-to-equation-for-plane--tp19182643p19197360.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list