Skip to content
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

Allow group variable to be passed as variable name when using formula #1837

Merged
merged 2 commits into from Jul 20, 2014

Conversation

Projects
None yet
3 participants
@kshedden
Copy link
Contributor

commented Jul 18, 2014

This is a small PR to allow the group variable to be passed to MixedLM.from_formula as either a variable name, or as an array-like object containing the actual group values. Currently the group values must be passed as an array.

@coveralls

This comment has been minimized.

Copy link

commented Jul 18, 2014

Coverage Status

Coverage increased (+0.0%) when pulling 51dd5b1 on kshedden:mixedlm_formula into 5c7d4be on statsmodels:master.

# Fit with a formula, passing groups as the variable name.
df["groups"] = groups
mod3 = MixedLM.from_formula(fml, df, re_formula=re_fml,
groups="groups")
rslt3 = mod3.fit()

This comment has been minimized.

Copy link
@josef-pkt

josef-pkt Jul 19, 2014

Member

how long do these take to fit?

since it's not important here, and in the other fit, to check convergence, we could add start_params = rslt2.params * 0.9 for example.

@kshedden

This comment has been minimized.

Copy link
Contributor Author

commented Jul 20, 2014

I added starting values for some of the tests as proposed. This revealed some shortcomings in the way I was handling starting values, so I adjusted that a bit here. Starting value handling is complex here due to the many different ways that the starting values can be specified. The starting values code seems to work as tested but still needs further review.

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Jul 20, 2014

Looks good to me. (But I don't know all the options.)

If it's ok, I can merge when TravisCI reports back green.

@coveralls

This comment has been minimized.

Copy link

commented Jul 20, 2014

Coverage Status

Coverage increased (+0.15%) when pulling 760e68a on kshedden:mixedlm_formula into 5c7d4be on statsmodels:master.

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Jul 20, 2014

merging

josef-pkt added a commit that referenced this pull request Jul 20, 2014

Merge pull request #1837 from kshedden/mixedlm_formula
ENH: Allow group variable to be passed as variable name when using formula

@josef-pkt josef-pkt merged commit 0390c7c into statsmodels:master Jul 20, 2014

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci The Travis CI build passed
Details

@josef-pkt josef-pkt added the PR label Aug 11, 2014

@josef-pkt josef-pkt added this to the 0.6 milestone Aug 24, 2014

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014

Merge pull request statsmodels#1837 from kshedden/mixedlm_formula
ENH: Allow group variable to be passed as variable name when using formula

@kshedden kshedden deleted the kshedden:mixedlm_formula branch Sep 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.