Dear R Help,

I read through the archives pretty extensively before sending this  
email, as it seemed there were several threads on using predict with  
GLM.  However, while my issue is similar to previous posts (cannot  
get it to predict using new data), none of the suggested fixes are  
working.

The important bits of my code:

set.seed(644)
n0=200 #number of observations
W1=rnorm(n0,mean=2,sd=2) #Use rnorm to generate W1
W2=rnorm(n0,mean=3,sd=8) #Use rnorm to generate W1
Aprob=matrix(.2, nrow=n0, ncol=1) #generating the probability of A
#generating probability of A dependant on W1
for(i in 1:n0){
if (W1[i]>1.5) {Aprob[i]=0.4}
}
A=matrix(rbinom(n0, 1, Aprob), nrow=n0, ncol=1) #generating the 0/1  
exposure
Yprob=1/(1+exp(-(10*A-5*(W1)^2+2*W2)))
Y=matrix(rbinom(n0, 1, Yprob), nrow=n0, ncol=1) #generating the 0/1  
exposure
zero=data.frame(rep(0, n0))


Q=glm(cbind(Y, 1-Y) ~ A + W1 + W2, family='binomial')
QA=predict(Q, newdata=as.data.frame(A))
Q0=predict(Q,newdata=(A=zero))

I've tried many variations of the last line (Q0) to get the predicted  
values when A=0 with no luck.  With this code,  I get errors that my  
A=zero is a list even though I made it into a data frame.  This is  
the version of the code (after my reading) that *should* work for  
predict once I can get it to accept that it is not a list.

With other variants of the line that will run but are not  
syntactically correct, my QA and Q0 are the same.

Any guidance would be appreciated!

Sherri




	[[alternative HTML version deleted]]

