Skip to content
Prev 306041 / 398506 Next

correlating matrices

Hello,

As for the first question, predict.lm with new data uses the formula 
used in the fit so do not change the way you pass on your new data. If 
the formula was Y ~ X1 + X2 you can use

newdata = data.frame(New1, New2)
newdata = data.frame(cbind(New1, New2))

but the order must be kept. (And why cbind, by the way?)

2. Use something folloing these lines. (Untested, obviously, without a 
data example.)
pred <- predict(...etc...)
no_na <- complete.cases( cbind(matrix1, matrix2) )

matrix1[ no_na, ] <- pred[1, ]
matrix2[ no_na, ] <- pred[2, ]


Hope this helps,

Rui Barradas

Em 21-09-2012 17:09, frauke escreveu: