[R] correlating matrices

PIKAL Petr petr.pikal at precheza.cz
Mon Sep 24 13:57:05 CEST 2012


Hi

before you can use predict you need to do lm(whatever.....). If you used

lm(whatever....., na.action=na.exclude)

predict will give you results with correctly placed NA values.

Regards
Petr


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of frauke
> Sent: Friday, September 21, 2012 6:10 PM
> To: r-help at r-project.org
> Subject: Re: [R] correlating matrices
> 
> Thank you for the fast help!
> 
> I am not sure though if I understand the predict.lm business. The
> newdata that I would make predictions from consists of six matrices,
> one for each variable. Do I cbind the matrices like you suggest for the
> regression and then convert them to a dataframe? How does R know which
> column in the matrix I created with cbind belongs to which variable in
> the regression?
> 
> One last question. If I use predict.lm without newdata it gives me as
> many data points as were used for the regression. However, in my
> matrices I have rows of NA for days without observations. My problem is
> now that if predict.lm only gives me the datapoints used for regression
> I can not match them to the actual observations days anymore. Is there
> anyway of keeping the original matrix and put the predicted value in
> it?
> 
> Thanks again, Frauke
> 
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/correlating-matrices-
> tp4643660p4643858.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.




More information about the R-help mailing list