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
GenericLikelihoodModel is the only built-in bootstrap method (besides some confint bootstrap in tsa).
There are currently problems, incomplete and outdated support for recreating a model for the bootstrap iteration.
specific case: I don't know how to get bootstrap for the MyPareto unit test cases to work #5143 (comment) edit I had printed out from the wrong results instance, everything in bootstrap with constrained model looks fine, although a bit cumbersome to use.
todo:
need unit tests that check what attributes, keywords are used in the recreated bootstrap models
refactor _init_keys/cloneattr
check how constrainted estimation, transform_params is supposed to work with recreating models
provide a prototype miscmodel, so we have it documented and have a unit test case for it.
#5143 fixes an issue when exog=None and a problem with cloneattr, however that's incomplete. It also has an example without constraints that seems to work.
bootstrap only stores params and not results instances, i.e. we cannot check from the outside which model attributes are used.
We don't need cov_params when we only keep params, i.e. we should skip Hessian/cov_params computation if not needed.
In another bootstrap version, we want to store other things, e.g. pivotal t-statistics, which will need more results.
GenericLikelihoodModelResults.bootstrap has no user specified fit_kwds.
another issue: fit(return="params")` because initializing the results instance can require relatively expensive computation, besides "skip_hessian"
(e.g. in GAM we need the hat_matrix_diag to estimate effective degrees of freedom)
getting other results from bootstrap, currently only mean params and bse/std is included, but we also return all parameter estimates of the bootstrap iterations
e.g. bootstrap confidence intervals, bootstrap cov, example from a discretized model in #7488
distribution dp = DiscretizedCount(stats.gamma)
Note: those use bootstrap parameter estimates directly and are not pivotal.
Currently we don't compute enough statistics in each bootstrap iteration to get pivotal bootstrap statistics.
res.params, res.bse, res.pvalues
(array([3.52635451, 0.42561606]),
array([0.51737782, 0.06370693]),
array([9.37271019e-12, 2.37570277e-11]))
res_boots = res.bootstrap()
res_boots[:2]
(array([3.64883387, 0.42001672]), array([0.47314425, 0.0545065 ]))
res_boots[2]
res.conf_int(alpha=0.1)
array([[2.67534372, 4.3773653 ],
[0.32082748, 0.53040464]])
[np.percentile(ri, 95, axis=0) for ri in res_boots[2].T]
[4.51308744241364, 0.522090578890195]
[np.percentile(ri, 5, axis=0) for ri in res_boots[2].T]
[2.941160216191393, 0.33520515755256414]
np.cov(res_boots[2].T)
array([[ 0.22612675, -0.02409635],
[-0.02409635, 0.00300097]])
res.cov_params()
array([[ 0.26767981, -0.03142997],
[-0.03142997, 0.00405857]])
also alternatives to case resampling, e.g. parametric bootstrap
Activity
josef-pkt commentedon Sep 10, 2018
bootstrap only stores params and not results instances, i.e. we cannot check from the outside which model attributes are used.
We don't need cov_params when we only keep
params, i.e. we should skip Hessian/cov_params computation if not needed.In another bootstrap version, we want to store other things, e.g. pivotal t-statistics, which will need more results.
GenericLikelihoodModelResults.bootstraphas no user specifiedfit_kwds.josef-pkt commentedon Nov 4, 2018
another issue:
fit(return="params")` because initializing the results instance can require relatively expensive computation, besides "skip_hessian"(e.g. in GAM we need the hat_matrix_diag to estimate effective degrees of freedom)
josef-pkt commentedon Jun 12, 2021
ENH:
getting other results from bootstrap, currently only mean params and bse/std is included, but we also return all parameter estimates of the bootstrap iterations
e.g. bootstrap confidence intervals, bootstrap cov, example from a discretized model in #7488
distribution
dp = DiscretizedCount(stats.gamma)Note: those use bootstrap parameter estimates directly and are not pivotal.
Currently we don't compute enough statistics in each bootstrap iteration to get pivotal bootstrap statistics.
also alternatives to case resampling, e.g. parametric bootstrap
josef-pkt commentedon Jun 12, 2021
docstring Return of bootstrap method is incorrect, it doesn't include
resultswhich it always returns.not option in bootstrap for
fitkeywords, e.g. start_params.Currently it always starts the fit in each bootstrap iteration with default start_params.
BUG/TST: fix recreating models for bootstrap see statsmodels#5169, mo…
BUG/TST: fix recreating models for bootstrap see statsmodels#5169, mo…
BUG/TST: fix recreating models for bootstrap see statsmodels#5169, mo…