[R] Use glm coefficients for other datasets

Ben Bolker bbolker at gmail.com
Tue Feb 8 22:57:24 CET 2011


maxsilva <mmsilva3 <at> uc.cl> writes:

> 
> 
> Thank you for your answer. But I still have the problem; for example, if i
> have data for 10 months, estimate the parameters of my logit model using 10
> months of data, and then use
> 
> predictions<-predict(model,data=1monthonly,family = binomial(link =
> logit),type="response") 
> 
> I still get the rpedictions vector with as many rows as the 10month dataset
> :(
> 
> What can I do to solve this issue?

  Read the documentation more carefully ... use

newdata=1monthonly

instead of

data=1monthonly

  In fact you should just use

predict(model,newdata=1monthonly,type="response")

  the 'family' argument is unnecessary (but not actually
causing any harm, other than confusion, I think)



More information about the R-help mailing list