plot.revision_model: Plot Revision Model Results

View source: R/graphs.R

plot.revision_modelR Documentation

Plot Revision Model Results

Description

Plot filtered or smoothed estimates for a selected state from a fitted revision model. Defined once for the parent class revision_model and inherited by kk_model and jvn_model objects alike; the state shown when state is not given is chosen by the concrete class.

Usage

## S3 method for class 'revision_model'
plot(x, state = NULL, type = "filtered", ...)

Arguments

x

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

state

String. The name of the state to visualize. If NULL, the family's default state is used: the latent true value for a jvn_model, and the first available state for a kk_model.

type

String. Type of estimate: "filtered" or "smoothed".

...

Additional arguments passed to theme_reviser.

Details

This method requires the state estimates to be available. A model fitted with solver_options$return_states = FALSE did not retain them, and plotting it fails with a message naming that option, in the same way states(), fitted(), residuals() and predict() do.

Value

A ggplot2 object.

See Also

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

Examples

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")

plot(result)


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