[R] help with prediction of GLM

From: penny77114 <penny77114_at_gmail.com>
Date: Fri, 07 Nov 2008 07:45:10 -0800 (PST)

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.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 07 Nov 2008 - 19:53:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Nov 2008 - 20:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive