You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clone method, information to reconstruct model, results #1093
see #1841 for duplicate issue with notes/comments by Kerby
just an idea for some use cases
llnull currently used in some models in summary for likelihood ratio test
for example Poisson
bootstrap attached as a method: conditional on exog: we would like to get a new instance of the model that we can reuse internally for running bootstrap replication.
We need to be able to clone, recreate a new instance of the model and then refit with new endog. Simple in OLS when we just have endog and exog. but we might need more information about what the user used in the signature in some models (if we want to write generic code).
results with robust cov_params: (my latest thought on design)
make it possible for users to specify which cov_params to use and all statistics in the results instance are based on this cov_params. Instead of changing cov_params in the given result instance, we create and return a new result instance.
I set a dynamic attribute in a subclass of Poisson that should go either as keyword in model.__init__ or model.fit. Currently summary breaks on trying to calculate llnul using a new model instance that doesn't have the attribute.
see #1221 llnull call doesn't take anything extra into account
@cache_readonly
def llnull(self):
model = self.model
#TODO: what parameters to pass to fit?
null = model.__class__(model.endog, np.ones(self.nobs)).fit(disp=0)
return null.llf
Activity
josef-pkt commentedon Apr 18, 2014
Does llnull work with NegativeBinomial? - check
A not supported example:
I set a dynamic attribute in a subclass of Poisson that should go either as keyword in
model.__init__ormodel.fit. Currently summary breaks on trying to calculate llnul using a new model instance that doesn't have the attribute.josef-pkt commentedon Apr 19, 2014
see #1221 llnull call doesn't take anything extra into account
josef-pkt commentedon Apr 19, 2014
proposal to get started with generic solution
add
initkeysattribute, with just a list of keys not full dictionary (to avoid extra references to full length data forremove_data)josef-pkt commentedon Apr 24, 2014
I had already use a different solution for bootstrap
setting registered attributes directly (
setattr) instead of going through the__init__kwdshttps://github.com/statsmodels/statsmodels/blob/master/statsmodels/base/model.py#L1591
This is more flexible in attaching additional attributes but might incorrectly skip some initialization code. (for example it would set the transformed
exposureinstead of the solution in #1609)josef-pkt commentedon Jun 1, 2014
GLM doesn't work yet because it doesn't have family in
_init_keysappending works from me (from the outside in an example)
I don't remember how offset and exposure are correctly added, but they are returned in
_get_init_kwds@kshedden still some changes to do to get all keywords for recreating a class.
I'm recreating the class for GLM.fit_constrained.
josef-pkt commentedon May 12, 2015
This is largely implemented for recreating models with
_init_kwds.TODO: check test coverage, models where this doesn't work (or is not needed yet)?
I'm opening a new issue specifically for (re)creating results instances, #2393