-
Notifications
You must be signed in to change notification settings - Fork 22
Coefficients and Parameters
This page documents methods for extracting and analysing model parameters from smooth models.
Extracts the estimated parameters from the model.
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# Extract all coefficients
coef(model)
# Same as
coefficients(model)from smooth import ADAM
model = ADAM(model="MMM", lags=12)
model.fit(y)
# Extract all coefficients
coefficients = model.coef
# Matching parameter names (coef is a bare NDArray)
model.coef_names # e.g. ['alpha', 'beta', 'gamma', 'level', 'trend', 'seasonal_1', ...]R: Returns a named vector containing:
- Smoothing parameters (alpha, beta, gammas, deltas)
- Damping parameter (phi) if applicable
- ARIMA parameters (AR, MA coefficients) if applicable
- Initial states (level, trend, seasonal, ARIMA states)
- Regression coefficients if applicable
Python: Returns an NDArray containing the estimated parameter vector (B). The
matching labels (in the same order) are available via model.coef_names, which
mirror R's naming (alpha, beta, gamma/gamma1, phi, level, trend,
seasonal_1…, ARIMA phi1[1]/theta1[1], regressor names, constant).
model <- adam(AirPassengers, "MAM", lags=12)
coef(model)
# Output:
# alpha beta gamma level trend seasonal1 ...
# 0.3521234 0.0012345 0.0001234 126.3456789 0.9987654 0.8765432 ...Computes confidence intervals for the estimated parameters.
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# 95% confidence intervals (default)
confint(model)
# 99% confidence intervals
confint(model, level=0.99)
# Bootstrap-based confidence intervals
confint(model, bootstrap=TRUE, nsim=1000)from smooth import ADAM
model = ADAM(model="MMM", lags=12)
model.fit(y)
# 95% confidence intervals (default) — returns a pandas DataFrame
model.confint()
# 99% confidence intervals
model.confint(level=0.99)
# Only selected parameters
model.confint(parm=["alpha", "beta"])Note: The Python
confint()reproduces R's interval construction, including the clamping of bounds to the admissible region for ETS smoothing parameters (alpha,beta,gamma,phi) and ARIMA AR/MA coefficients. Bootstrap intervals (bootstrap=TRUE) are R-only.
| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
object / model |
adam |
ADAM (self) |
- | Fitted model |
parm |
character |
list / str / None
|
NULL / None
|
Which parameters (NULL/None = all) |
level |
numeric | float |
0.95 | Confidence level |
bootstrap |
logical | (R only) | FALSE | Use bootstrap for intervals (passed to vcov()) |
step_size |
- |
float / None
|
- / None
|
Finite-difference step for the Fisher Information |
... |
- | - | - | Additional parameters passed to vcov() if bootstrap=TRUE (R) |
-
R: a matrix with columns
S.E.(if bootstrap=TRUE), lower bound (e.g.2.5%) and upper bound (e.g.97.5%). -
Python: a
pandas.DataFrameindexed by the parameter names (model.coef_names) with columns["S.E.", "<lo>%", "<hi>%"](e.g.2.5%,97.5%).
Python occurrence models:
confint()is not yet available forOM/OMG(the cumulative-logistic occurrence distribution is unsupported in the Fisher Information path) — see OM.
Returns the variance-covariance matrix of the estimated parameters. It is obtained by inverting the observed Fisher Information matrix (the negative Hessian of the log-likelihood at the optimum).
model <- adam(AirPassengers, "AAN", h=12, holdout=TRUE)
# Get covariance matrix (Fisher Information based)
V <- vcov(model)
# Bootstrap-based covariance matrix
V <- vcov(model, bootstrap=TRUE, nsim=1000)
# Heuristic estimation (fast approximation)
V <- vcov(model, heuristics=0.1)
# Standard errors
sqrt(diag(V))import numpy as np
from smooth import ADAM
model = ADAM(model="AAN")
model.fit(y)
# Covariance matrix (Fisher Information based) — pandas DataFrame
V = model.vcov()
# Heuristic estimation (fast diagonal approximation)
V = model.vcov(heuristics=0.1)
# Standard errors
np.sqrt(np.diag(V))Note: When the model was fitted with
fi=True, the cached Fisher Information is reused; otherwise it is computed on demand. Bootstrap covariance (bootstrap=True) is not implemented in Python and raisesNotImplementedError.
| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
object / model |
adam |
ADAM (self) |
- | Fitted model |
bootstrap |
logical |
bool (raises if True)
|
FALSE / False | Use bootstrap (R: calls coefbootstrap()) |
heuristics |
numeric |
float / None
|
NULL / None
|
If set, variance equals abs(coef)*heuristics. Fast approximation |
step_size |
- |
float / None
|
- / None
|
Finite-difference step for the Fisher Information |
... |
- | - | - | Additional parameters passed to coefbootstrap() if bootstrap=TRUE (R) |
Returns a square matrix (R) / pandas.DataFrame (Python) with:
- Rows/columns named by parameters (Python:
model.coef_names) - Diagonal contains variances
- Off-diagonal contains covariances
Python occurrence models:
vcov()is not yet available forOM/OMG— see OM.
Generates bootstrap estimates of model coefficients for inference. Method is defined in greybox and extended for adam.
Python: Not yet implemented.
model <- adam(AirPassengers, "AAN", h=12, holdout=TRUE)
# Bootstrap with default settings
bootCoef <- coefbootstrap(model)
# Bootstrap with custom settings
bootCoef <- coefbootstrap(model, nsim=500, method="dsr", parallel=TRUE)
# Examine distribution
hist(bootCoef$coefficients[,"alpha"])
# Bootstrap confidence intervals
apply(bootCoef$coefficients, 2, quantile, probs=c(0.025, 0.975))
# Extract the covariance matrix
bootCoef$vcov| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
object |
adam | TBA | - | Fitted model |
nsim |
integer | TBA | 1000 | Number of bootstrap samples |
size |
integer | TBA | floor(0.75*nobs(object)) | Size of each bootstrap sample. Used in method="cr"
|
replace |
logical | TBA | FALSE | Sample with replacement. Needed for method="cr". |
prob |
numeric vector | TBA | NULL | Probability weights for sampling. Used in method="cr"
|
parallel |
logical/integer | TBA | FALSE | Use parallel processing. If integer, specifies number of cores |
method |
character | TBA | "cr" | Bootstrap method: "cr" (Case Resampling) or "dsr" (Data Shape Replication) |
... |
- | TBA | - | Additional parameters |
| Method | Description |
|---|---|
"cr" |
Case Resampling - resamples observations with varying sample sizes |
"dsr" |
Data Shape Replication - model free, creates data of the similar shape as the original series |
Returns an object of class "bootstrap" containing:
| Element | Description |
|---|---|
vcov |
Covariance matrix of bootstrapped coefficients |
coefficients |
Matrix of bootstrapped coefficients (rows: samples, columns: parameters) |
method |
Bootstrap method used ("cr" or "dsr") |
nsim |
Number of simulations performed |
size |
Sample size used (NA for some methods) |
replace |
Whether replacement was used |
prob |
Probability weights used |
parallel |
Whether parallel processing was used |
model |
Model call |
timeElapsed |
Time elapsed for computation |
- ADAM - Main ADAM function
- Fitted-Values-and-Forecasts - Fitted values, forecasts and simulation
- Refitting-and-Reforecasting - Parameter uncertainty analysis
- Visualisation-and-Output - Plotting forecasts