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

ENH: add cov_type fixed_scale to linear model #2137

Merged
merged 5 commits into from
Jan 8, 2015

Conversation

josef-pkt
Copy link
Member

closes #2142 (I opened that issue for the record and to link to the mailing list discussions)

cov_type that allows fixing the scale in the linear model.
main use_case is when weights in WLS are actual inverse variances

see discussions on mailing list

Todo:

  • check other results
    • llf uses MLE scale
    • AIC, ... ?
  • docstring
  • example
  • unit tests for scale kwd

DONE except for llf/loglike which needs refactoring, in all 3 linear regression models

Questions:
Should we change the default to use_t=False? answer on mailing list: Yes
I think so, but IIRC we don't do it now as part of cov_type. (use_t was part of cov_type but is now mostly a separate, independent keyword.)
correction: we already have use_t=False as default for every cov_type except 'nonrobust', set in RegresssionResults.__init__ - nothing to do in this PR

Do we want to overwrite the scale attribute?
It's not necessary for cov_params and a bit of a pain to change - issues for unrelated refactoring.
skip this for now. this depends on other uses of the scale attribute

Follow-up question

Where do we put the relevant chisquare gof test, which only applies in the case of fixed scale?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling bca64ba on josef-pkt:cov_type_fixedscale into 923aaf3 on statsmodels:master.

@cdeil
Copy link
Contributor

cdeil commented Dec 17, 2014

Thanks for putting this in!!!

As a unit test ... how about taking the example from scipy.optimize.curve_fit with absolute_sigma=True?
https://github.com/scipy/scipy/blob/7750f4f6e9f4a6fd7b026f658aab6cb72da2c249/scipy/optimize/tests/test_minpack.py#L341

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) when pulling 309f447 on josef-pkt:cov_type_fixedscale into 923aaf3 on statsmodels:master.

@josef-pkt josef-pkt mentioned this pull request Dec 17, 2014
@josef-pkt
Copy link
Member Author

@cdeil I added one set of unit tests from the scipy curve_fit tests. Thanks for the suggestion.

@josef-pkt
Copy link
Member Author

I would like to leave the loglike refactoring to another PR, which means loglike and llf are not correct for fixed scale.

merge as is ?

@cdeil
Copy link
Contributor

cdeil commented Dec 18, 2014

Looks good to me: 👍 to merge.

@josef-pkt josef-pkt mentioned this pull request Jan 8, 2015
29 tasks
@josef-pkt
Copy link
Member Author

only two merges behind master, merging as is

josef-pkt added a commit that referenced this pull request Jan 8, 2015
ENH: add cov_type fixed_scale to linear model closes #2142
@josef-pkt josef-pkt merged commit c5e0169 into statsmodels:master Jan 8, 2015
@josef-pkt josef-pkt added this to the 0.7 milestone Jan 8, 2015
@josef-pkt
Copy link
Member Author

@ceil Thanks for the feedback
I will come back to this, but for now I'm doing a round of unrelated merges.

that llf/loglike are independent of the cov_type is "not nice"

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

Successfully merging this pull request may close these issues.

fixed scale in WLS
3 participants