Hello I am creating a linear model with the command

net5 = lm( X[,1] ~ PrinComp[,1:5]) where my vector PrinComp looks like this

> head(PrinComp[,1:5])
           PC1         PC2        PC3        PC4        PC5
[1,] 1.8626055 -3.34190998 -0.5448889  2.8296751  0.3994096
[2,] 3.1124144 -1.68113572  1.7187314 -2.0162583 -0.2935675
[3,] 3.3538049 -0.05471002 -2.9385065  0.6921495 -2.2743761
[4,] 2.3491111  1.46433537  3.2600091  0.5121311 -2.2212727
[5,] 1.4467501  2.64829347 -2.4559811 -2.4745585 -2.3537081
[6,] 0.1575151  3.35242794  1.9367978  3.0293779 -1.4176263
now I am trying to use the predict command like this

y=predict(net5, newdata=data.frame(PrinCompPredict)[,1:5])          where

> data.frame(PrinCompPredict)[,1:5]
       PC1      PC2      PC3       PC4      PC5
1 6.473546 7.529725 1.192588 0.1401967 10.81945

and I am getting the following error message,
Mensajes de aviso perdidos
'newdata' had 1 rows but variable(s) found have 164 rows

Does anybody know what can be wrong with this? thank you

Felipe Parra

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to