| revision_model | R Documentation |
reviser represents every fitted revision-nowcasting model as an S3 object
that inherits from the common parent class revision_model. The two
concrete classes are kk_nowcast(), which returns a kk_model, and
jvn_nowcast(), which returns a jvn_model; both carry
c("<family>_model", "revision_model", "list") as their class attribute.
The parent class holds everything the two families share. The standard
extractor generics coef(), vcov(), logLik(), nobs(), fitted(),
residuals(), predict() and the reviser generic states(), together
with print(), summary() and plot(), are defined once for
revision_model and inherited by both families. Only the handful of
behaviors that genuinely differ between the families are dispatched
separately, through the internal generics model_family(), spec_lines(),
signal_state(), target_column() and default_plot_state().
A fitted object is a list with at least the components params (a data
frame with columns Parameter, Estimate and Std.Error), states (a
long tibble of state estimates, or NULL when the model was fitted with
return_states = FALSE), loglik, n_param, n_ic, cov and data.
A new model family becomes a full citizen of this system by returning an
object with those components, prepending "revision_model" to its class
attribute, and supplying methods for the five internal generics above.
This topic documents a class rather than a function. kk_nowcast()
returns a list of the components described above with class attribute
c("kk_model", "revision_model", "list"), and jvn_nowcast() returns the
same with "jvn_model" in place of "kk_model".
kk_nowcast(), jvn_nowcast(), states()
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(),
states(),
summary.revision_model(),
vcov.revision_model()
df <- get_nth_release(
tsbox::ts_span(
tsbox::ts_pc(dplyr::filter(reviser::gdp, id == "US")),
start = "1980-01-01"
),
n = 0:1
)
df <- na.omit(dplyr::select(df, -c("id", "pub_date")))
fit <- kk_nowcast(df, e = 1, model = "KK", method = "OLS")
# The fitted object carries the shared parent class.
class(fit)
inherits(fit, "revision_model")
# The extractor generics are inherited from that parent.
head(coef(fit))
head(states(fit))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.