Re: [Rd] strange bahaviour of predict.lm

2020-03-17 Thread Rui Barradas
Hello, I'm glad that it worked. Two things: 1. Please, click reply all to keep this threaded. 2. The question should have belonged to r-h...@r-project.org, not to r-devel@r-project.org. Rui Barradas Às 07:10 de 17/03/20, Moshe Olshansky escreveu: It works, thank you! On Tuesday, 17 March 2

Re: [Rd] strange bahaviour of predict.lm

2020-03-16 Thread Rui Barradas
Hello, The problem seems to be that A is a matrix. The following solves the error. # create A and b as in your code then run A <- as.data.frame(A) df1 <- cbind(A, b) reg <- lm(b ~ ., df1) # etc Hope this helps, Rui Barradas Às 04:36 de 17/03/20, Moshe Olshansky via R-devel escreveu: Hello,

[Rd] strange bahaviour of predict.lm

2020-03-16 Thread Moshe Olshansky via R-devel
Hello, Below is my code: > A <- matrix(rnorm(10*3),ncol=3) > b <- runif(10) > reg <- lm(b ~ A) > A1 <- matrix(rnorm(5*3),ncol=3) > A1 <- as.data.frame(A1) > b1 <- predict(reg,A1) Warning message: 'newdata' had 5 rows but variables found have 10 rows   And instead of being an array of length 5, b1