Re: [R] glm predict on new data

2011-04-06 Thread Brian Diggs
On 4/6/2011 2:17 PM, dirknbr wrote: I am aware this has been asked before but I could not find a resolution. I am doing a logit lg<- glm(y[1:200] ~ x[1:200,1],family=binomial) glm (and most modeling functions) are designed to work with data frames, not raw vectors. Then I want to predict

Re: [R] glm predict on new data

2011-04-06 Thread Tóth Dénes
Dear Dirk, You should avoid indexing in the glm call so that the name of the terms will not contain the indexing part. (Check str(lg) in your example.) A more preferred solution uses predefined data frames in the original calls: n <- 250 x <- rnorm(n) noise <- rnorm(n,0,0.3) y <- round(exp(x+nois

[R] glm predict on new data

2011-04-06 Thread dirknbr
I am aware this has been asked before but I could not find a resolution. I am doing a logit lg <- glm(y[1:200] ~ x[1:200,1],family=binomial) Then I want to predict a new set pred <- predict(lg,x[201:250,1],type="response") But I get varying error messages or warnings about the different number