| kk_nowcast | R Documentation |
Implements a generalized Kishor-Koenig (KK) model for nowcasting and forecasting with state-space models, allowing for multiple vintages of data, efficient estimation, and Kalman filtering and smoothing.
kk_nowcast(
df,
e,
h = 0,
model = "Kishor-Koenig",
method = "MLE",
alpha = 0.05,
solver_options = list()
)
df |
A data frame or single-ID vintages object in either long or wide
format. Long-format vintages data are converted internally. After
preprocessing, the data must contain a |
e |
An integer indicating the number of data vintages to include in the model. Must be greater than 0. |
h |
An integer specifying the forecast horizon. Default is 0, which implies no forecasts. Must be greater than or equal to 0. |
model |
A string specifying the type of model to use. Options are:
|
method |
A string specifying the estimation method to use. Options are "MLE" (Maximum Likelihood, default), "SUR", and "OLS". |
alpha |
Significance level for confidence intervals (default = 0.05). |
solver_options |
A named list controlling the SUR and MLE routines.
Valid names are
For backward compatibility, the legacy aliases |
The function supports multiple models, including the full Kishor-Koenig
framework, Howrey's model, and a classical approach. It handles data
preprocessing, estimation of system equations using Seemingly Unrelated
Regressions (SUR), and application of the Kalman filter. This is
the first openly available implementation of the Kishor-Koenig model (See
the vignette vignette("nowcasting_revisions") for more details).
A list with the following components:
A tibble containing filtered and smoothed state estimates. If
solver_options$return_states = FALSE, this is NULL.
A list of KK model matrices, such as transition and observation matrices.
A list of state-space model matrices derived from the KK model.
The fitted KFAS::SSModel object. If
solver_options$return_states = FALSE, this is NULL.
Estimated model parameters with standard errors.
The raw fit object returned by the selected estimator.
Log-likelihood value for MLE fits; otherwise NULL.
Akaike information criterion for MLE fits; otherwise NULL.
Bayesian information criterion for MLE fits; otherwise NULL.
Convergence status.
The number of the efficient release (0-indexed).
The input data after preprocessing to wide format.
The standard-error method used by MLE; otherwise NULL.
Estimated covariance matrix of the parameter estimates, if
available; otherwise NULL.
Kishor, N. Kundan and Koenig, Evan F., "VAR Estimation and Forecasting When Data Are Subject to Revision", Journal of Business and Economic Statistics, 2012.
Other revision nowcasting:
coef.revision_model(),
fitted.revision_model(),
jvn_nowcast(),
logLik.revision_model(),
nobs.revision_model(),
plot.revision_model(),
predict.revision_model(),
print.revision_model(),
residuals.revision_model(),
revision_model,
states(),
summary.revision_model(),
vcov.revision_model()
# Example usage:
df <- get_nth_release(
tsbox::ts_span(
tsbox::ts_pc(
dplyr::filter(reviser::gdp, id == "US")
),
start = "1980-01-01"
),
n = 0:1
)
df <- dplyr::select(df, -c("id", "pub_date"))
df <- na.omit(df)
e <- 1 # Number of efficient release
h <- 2 # Forecast horizon
result <- kk_nowcast(df, e, h = h, model = "Kishor-Koenig")
# Fitted models are reached through the extractor generics inherited from
# the parent class, not by indexing into the object.
coef(result)
logLik(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.