Zelig icon indicating copy to clipboard operation
Zelig copied to clipboard

Allow users to pass non-Zelig fitted model objects to `setx`--proposed modified Zelig workflow

Open christophergandrud opened this issue 7 years ago • 3 comments

@izahn and I were having a chat yesterday about how to make Zelig more accessible to a wider range of users. One particular issue we discussed was the zelig estimation step.

Advantages and difficulties

This step has a lot of advantages--works well with Amelia and MatchIt, provides a common syntax for a lot of models, allows the implementation of methods such as gim. However, it has a few disadvantages:

  • creates potential for code breaks if zelig stops being able to feed information to the wrapped estimation function

  • creates potential for code breaks if zelig syntax changes

  • creates Zelig estimation objects that can be difficult to use with non-Zelig post-estimation functions

  • if users already have their code written with lm, glm, etc, then to add Zelig qi sims/plots they need to rewrite their code

  • hard to document

Is there a way have both the advantages of zelig and alleviate these issues?

Proposed modified Zelig workflow

I think there might be, and it may not actually require a lot of new code. Here's my early early thought:

proposed_modified_zelig_use_flow

Workflow A: The workflow on the left is the current Zelig 5 workflow.

Workflow B: The workflow on the right starts with users estimating their model with a currently wrapped estimation function. They then pass the fitted model object to setx. setx recognises that the object is not a Zelig object, but is from a supported model. So it passes the object to a new function called to_zelig, which converts it to a Zelig fitted model object. This is then passed to setx and the workflow converges with Workflow A.

Of course this proposal does not address all of the issues mentioned above.

Thoughts?

Side note: this may also make it easier for us to move more of the external estimation packages to Suggests (see https://github.com/IQSS/Zelig/issues/170).

christophergandrud avatar Jan 27 '17 14:01 christophergandrud

I'm not sure I understand the use-case very well. Perhaps if you want to port existing code to Zelig that would be helpful. But the cost of changing a few lines doesn't seem that bad if you really care about what setx gives you.

The other direction seems more important to me: for example, getting a glm object out of zelig. Say you want to use another package which is not directly compatible with Zelig (e.g., texreg or plotMElm), then it would be nice to have an easy way to get a glm object out of your Zelig(model='logit').

vincentarelbundock avatar Jan 31 '17 13:01 vincentarelbundock

@izahn actually also brought this up. Something like a from_zelig function:

img_20170131_083425

I think that makes a lot of sense and shouldn't be too difficult to implement (famous last words).

christophergandrud avatar Jan 31 '17 13:01 christophergandrud

FYI, from_zelig_model is available from version 5.0-15.

christophergandrud avatar Feb 21 '17 14:02 christophergandrud