Skip to content

zelig should return the model.frame #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
izahn opened this issue Jan 25, 2013 · 2 comments
Open

zelig should return the model.frame #38

izahn opened this issue Jan 25, 2013 · 2 comments

Comments

@izahn
Copy link

izahn commented Jan 25, 2013

zelig does not return the model frame, which causes plot to fail:

m0 <- lm(mpg ~ hp*am, data=mtcars)
m1 <- zelig(mpg ~ hp*am, model="ls", data=mtcars, cite=FALSE)

plot(m0) #diagnostic plots
plot(m1) #does not work: Error in eval(predvars, data, env) : invalid 'envir' argument

m1$result$model <- m0$model
plot(m1)# works

So plot appears to fail because the model component of the lm results list is not available. This should be added so that plot and other methods that depend on the model component of the list will work correctly.

This is with Zelig version 4.1-2

@whatever
Copy link
Contributor

Thanks, and nice catch. I just altered how external methods are called, and this seems related (Issue #34).

I'll likely add a hook for the core GLM models.

@theresea
Copy link

I just ran into the same problem. My code including the plot(z.out1) command returns the error "Error in eval(predvars, data, env) : invalid 'envir' argument of type 'closure'". The fix above does not work for me because I am letting Zelig estimate robust standard errors.

Is there any general fix yet? How can I alternatively produce the diagnostic plots from the z.out1-object?

Any quick responses are highly appreciated as I only ran into this now and need to turn in my thesis by tomorrow. Thank you!

mydata2$dlhs3_anc_gov<-ifelse(mydata2$dlhs3_anc_gov<=1,mydata2$dlhs3_anc_gov,NA)
fm3<-logit(dlhs3_anc_gov)~death0406_av+lnpcgdp0405+ln_totalpop+URBANISATION+totalliteracyrate+CST_percent+dlhs2_anc_gov
z.out3<-zelig(fm3,model="ls",data=mydata2,robust=TRUE)
summary(z.out1) #runs without a problem
plot(z.out1) #returns Error in eval(predvars, data, env) : invalid 'envir' argument of type 'closure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants