states: Extract the Latent State Estimates of a Revision Model

View source: R/model-methods.R

statesR Documentation

Extract the Latent State Estimates of a Revision Model

Description

Accessor for the state paths of a fitted revision-nowcasting model. Provides programmatic access to the estimated states instead of reaching into the object with fit$states. The method is defined once for the parent class revision_model and is inherited by kk_model and jvn_model objects alike.

Usage

states(object, ...)

## S3 method for class 'revision_model'
states(object, filter = c("smoothed", "filtered", "all"), state = NULL, ...)

Arguments

object

A fitted model object inheriting from revision_model, such as a kk_model or a jvn_model.

...

Additional arguments passed to methods.

filter

Which state estimates to return: "smoothed" (default) uses the full sample, "filtered" uses information available up to each date, and "all" returns both.

state

Optional character vector of state names to keep. Defaults to all states.

Value

A tibble with columns time, state, estimate, lower, upper, filter and sample.

See Also

Other revision nowcasting: coef.revision_model(), fitted.revision_model(), jvn_nowcast(), kk_nowcast(), logLik.revision_model(), nobs.revision_model(), plot.revision_model(), predict.revision_model(), print.revision_model(), residuals.revision_model(), revision_model, summary.revision_model(), vcov.revision_model()

Examples


gdp_growth <- dplyr::filter(
  tsbox::ts_pc(reviser::gdp),
  id == "EA",
  time >= min(pub_date),
  time <= as.Date("2020-01-01")
)
gdp_growth <- tidyr::drop_na(gdp_growth)
df <- get_nth_release(gdp_growth, n = 0:3)

fit <- jvn_nowcast(df = df, e = 4, ar_order = 2, include_noise = FALSE)
head(states(fit))
head(states(fit, filter = "filtered", state = "true_lag_0"))



reviser documentation built on Sept. 14, 2026, 9:09 a.m.