[R] Predict Function
Biago
sgrlfskbm at gmail.com
Sat Apr 12 20:06:04 CEST 2008
Hi all - my first time here and am having an issue with the Predict function.
I am using a tutorial as a guide, locate here:
http://www.ats.ucla.edu/STAT/R/dae/mlogit.htm
My code gives this error
> newdata1$predicted <- predict(mlogit,newdata=newdata1,type="response")
Error in `$<-.data.frame`(`*tmp*`, "predicted", value = c(0.332822934960197,
:
replacement has 810 rows, data has 6
How can I resolve this problem so I can just predict values for the supplied
matrix(newdata1) instead of it trying to use my full dataset?
Here is the full code up to this point.
library(VGAM)
mlogit<- vglm(bcsse$Active~bcsse$Impinteg+bcsse$Hsgradyr,
family=multinomial(), na.action=na.pass)
summary(mlogit)
Impinteg<-c(1,2,3,4,5,6)
Hsgradyr<-c(mean(bcsse$Hsgradyr))
newdata1<-data.frame(Impinteg,Hsgradyr)
newdata1$predicted <- predict(mlogit,newdata=newdata1,type="response")
newdata1
I appreciate all help in advance!
--
View this message in context: http://www.nabble.com/Predict-Function-tp16654037p16654037.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list