View source: R/dawid_sebastiani.R
ds_score_hhh4 | R Documentation |
Calculate Dawid-Sebastiani score for a prediction returned by predictive_moments
.
ds_score_hhh4(pred, detailed = FALSE, scaled = TRUE)
pred |
the prediction as returned by |
detailed |
detailed or less detailed output? |
scaled |
if |
The Dawid-Sebastiani score is defined as
DSS = log(|\Sigma|) + t(Y_obs - \mu) \Sigma^{-1} (Y_obs - \mu)
where \mu
and \Sigma
are the predictive mean and variance, repectively.
Y_obs represents the observation that has materialized.
If detailed == FALSE
: the (potentially scaled) Dawid-Sebastiani score. If
detailed == TRUE
: a vector containing the following elements:
dawid_sebastiani
the un-scaled Dawid-Sebastiani score
term1
value of the log-determinant entering into the unn-scaled Dawid-Sebastiani score
term2
value of the quadratic form entering into the un-scaled Dawid-Sebastiani score
scaled_dawid_sebastiani
the scaled Dawid-Sebastiani score
determinant_sharpness
the determinant sharpness (scaled version of term1
)
## a simple univariate example:
data("salmonella.agona")
## convert old "disProg" to new "sts" data class
salmonella <- disProg2sts(salmonella.agona)
# specify and fit model: fixed geometric lag structure
# with weight 0.8 for first lag
control_salmonella <- list(end = list(f = addSeason2formula(~ 1)),
ar = list(f = addSeason2formula(~ 1),
par_lag = 0.8, use_distr_lag = TRUE),
family = "NegBinM", subset = 6:312)
fit_salmonella <- hhh4_lag(salmonella, control_salmonella)
pred_salmonella <- predictive_moments(fit_salmonella, t_condition = 260,
52, return_Sigma = TRUE)
ds_score_hhh4(pred_salmonella, detailed = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.