Skip to content

ENH: Add initialization via keyword args to init. - #2488

Merged
josef-pkt merged 3 commits into
statsmodels:masterfrom
ChadFulton:ss-init
Jul 3, 2015
Merged

josef-pkt merged 3 commits into
statsmodels:masterfrom
ChadFulton:ss-init

Conversation

@ChadFulton

Copy link
Copy Markdown
Member

Fixes #2264. Quoting from there:

Currently, the Kalman filter initialization must be performed after construction. Need to add the ability to specify it during construction via keyword argument. Four new keywords (and then class attributes) would be specified:

Parameters
----------

initialization : {'approximate_diffuse','stationary','known'}, optional
    Method
initial_variance : float, optional
    If approximate diffuse initialization is used, the initial variance of states.
initial_state : array_like, optional
    If known initialization is used, the mean of the initial state's distribution.
initial_state_cov : array_like, optional
    If known initialization is used, the covariance matrix of the initial state's distribution.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate? see line 105

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does initial_variance need to be an array if state is not 1-d? Or is diffusive spherical, s * eye?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Initial variance is spherical in the approximate diffuse case. You could make them elliptical but I can't really imagine an application for it, since the idea is that it should be "infinite" and we're just approximating infinity.

@josef-pkt

Copy link
Copy Markdown
Member

good/necessary to merge for 0.7. smaller inline comments (I didn't check the implementation details)

Would it be better to add the new keywords explicitly to the signature instead of hiding them in kwargs? I don't remember how the init across multiple inheritance and decoupling works.

I don't have an alternative, but we might want to think about combining groups of related keywords into dictionaries to shorten the signature. (I used in some cases dictionary like cov_kwds or optim_kwds, but that has the disadvantage that it doesn't show what keys are allowed in those dictionaries.)

@ChadFulton

Copy link
Copy Markdown
Member Author

Would it be better to add the new keywords explicitly to the signature instead of hiding them in kwargs? I don't remember how the init across multiple inheritance and decoupling works.

I think it would be better to leave in kwargs. They affect the way the Kalman filter runs, and in the SARIMAX case the default (which is a fully or partially stationary initialization) is almost always better. I use the diffuse case to test against Stata, but otherwise I don't think people would want to use it.

@ChadFulton

Copy link
Copy Markdown
Member Author

I don't have an alternative, but we might want to think about combining groups of related keywords into dictionaries to shorten the signature. (I used in some cases dictionary like cov_kwds or optim_kwds, but that has the disadvantage that it doesn't show what keys are allowed in those dictionaries.)

This might be worth pursuing in terms of something like filter_kwds. I'll add a note to the decoupling PR.

@ChadFulton

Copy link
Copy Markdown
Member Author

Issues above fixed, tests added for coverage, and rebased against master. When everything is green it should be good to merge.

@josef-pkt

Copy link
Copy Markdown
Member

Thanks @ChadFulton merging

josef-pkt added a commit that referenced this pull request Jul 3, 2015
ENH: Add initialization via keyword args to init.
@josef-pkt
josef-pkt merged commit e568f56 into statsmodels:master Jul 3, 2015
@ChadFulton
ChadFulton deleted the ss-init branch July 3, 2015 16:12
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.

2 participants