RE: [R] lm with predictor matrix

2004-05-10 Thread Liaw, Andy
Try: x = matrix(runif(30), 10, 3) newx = matrix(runif(15), 5, 3) y = rnorm(10) fit = lm(y ~ x) newyhat = predict(fit, newdata=data.frame(x=I(newx))) HTH, Andy From: Claus Gwiggner Hello, can someone give me an example of how to fit a linear model where the response is a matrix,

Re: [R] lm with predictor matrix

2004-05-10 Thread Roger D. Peng
Your problem might be that the names of 'newframe' don't match the column names of 'tailmatrix'. It's hard to tell because you don't provide an example. Is 'newframe' a matrix or a dataframe? If it is a dataframe, try: names(newframe) - colnames(tailmatrix) predict(fit, newframe) -roger