Use glm coefficients for other datasets
Thank you for your kindness, but ive done what you've said and the problem remains. What im doing is pretty straightforward,
data
response pred1 pred2 1 1 0 1 2 0 0 0 3 1 0 0 4 1 1 1 5 1 0 1 6 0 1 1 7 1 1 0 8 1 0 1 9 0 1 1 10 0 0 1
sdata <- data[sample(nrow(data), 5), ] sdata
response pred1 pred2 8 1 0 1 2 0 0 0 9 0 1 1 10 0 0 1 6 0 1 1
model<-glm(data$response~data$pred1+datos$pred2,
family=binomial(link="logit"))
summary(model)
###the model ran correctly But when I ask for the predictions,
pred<- predict(model, newdata=sdata,type="response")
Mensajes de aviso perdidos 'newdata' had 5 rows but variable(s) found have 10 rows
length(pred)
[1] 10 And those 10 values are the fitted values corresponding for the model over its origin dataset. I really can't get what's the problem...
View this message in context: http://r.789695.n4.nabble.com/Use-glm-coefficients-for-other-datasets-tp3276626p3296561.html Sent from the R help mailing list archive at Nabble.com.