[R] help with prediction of GLM
penny77114
penny77114 at gmail.com
Fri Nov 7 16:45:10 CET 2008
So, I have training data, and testing data
however, when I try to predict values for the testing data, it gives me
values for the training data. what gives?
the following is my code:
train = read.table(train.txt, header = TRUE, sep = " ")
test = read.table(test.txt, header = TRUE, sep = " ")
model = glm(formula = train[,10]~ train[2] + train[3] + ... + train[9],
family = binomial("logit"))
pred = predict(model, newdata = test.txt, type = "response")
and then I get an warning:
"Warning messages:
1: 'newdata' had 45014 rows but variable(s) found have 45001 rows
2: In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type ==
:
prediction from a rank-deficient fit may be misleading
"
and it seems it's not reading the newdata at all, as the pred is exactly the
same whether I put
pred = predict(model, newdata = test.txt, type = "response")
or
pred = predict(model, type = "response")
thanks in advance for any help
--
View this message in context: http://www.nabble.com/help-with-prediction-of-GLM-tp20383039p20383039.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list