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-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of frauke > Sent: Friday, September 21, 2012 6:10 PM > To: r-help@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@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. ______________________________________________ R-help@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.