smooth.AutoADAM.coefbootstrap
- AutoADAM.coefbootstrap(nsim=1000, size=None, replace=False, prob=None, parallel=False, method='cr', seed=None, verbose=False)
Bootstrap the coefficient sampling distribution by refitting subsamples.
Mirrors R’s
coefbootstrap.adam(R/adam.R:4850-5113). Drawsnsimcase-resamples of the in-sample series, refits the same model on each, and returns the empirical covariance / replicate matrix. The dispatch invcov()andconfint()forwardsbootstrap=Truehere.- Parameters:
nsim (
int) – Number of bootstrap replicates.size (
Optional[int]) – Subsample size per replicate. Defaults tofloor(0.75 * nobs), matching R.replace (
bool) – Resample with replacement.prob (
Optional[NDArray]) – Sampling probabilities per observation (uniform ifNone).parallel (
Union[bool,int]) –Trueruns replicates in parallel viajoblib.Parallel(cpu_count - 1workers). An integer specifies the exact worker count. Requires the optionaljoblibdependency (pip install jobliborpip install "smooth[parallel]"); ifjoblibis not importable, a one-line warning is emitted and the call falls back to a serial loop.method (
str) –"cr"is case resampling (the implemented path)."dsr"(data-shape replication, R’sgreybox::dsrboot) raisesNotImplementedError.seed (
Optional[int]) – Seed for thenumpy.random.Generatorused to draw indices. Makes the result reproducible (same indices in serial and parallel modes — the optimiser is deterministic given a fixed sample).verbose (
bool) – Print a one-line progress message every 10% of replicates (in parallel mode, forwardsverbose=10tojoblib.Parallel).
- Returns:
Container with
.vcov,.coefficients,.method,.nsim,.nsim_effective,.size,.time_elapsed, … Mirrors R’s"bootstrap"S3 class..parallelreflects whether parallel execution actually ran (Falsewhen we fell back due to a missingjoblib).- Return type:
smooth.adam_general.core.utils.bootstrap.BootstrapResult
Notes
Replicates whose refit fails (non-convergence, mismatched parameter count) are dropped silently;
result.nsim_effectivereports the count that contributed to the variance estimate.Bootstrap on a model with external regressors (
X) is not yet supported and will raise.Examples
>>> m = ADAM(model="ANN").fit(y) >>> b = m.coefbootstrap(nsim=50, seed=42) >>> b.vcov.shape (1, 1)
Parent Class: AutoADAM