This function fit models with selected hyperparameters on reported data and return a matrix of posterior Laplace samples.
train_and_validate(
reported,
delay_dist,
lam,
dof,
beta0 = NULL,
regularization_order = 2,
reported_val = NULL,
end_pad_size = 0,
fisher_approx_cov = TRUE,
num_samps_per_ar = 10
)
An integer vector of reported cases.
A positive vector that sums to one, which describes the delay distribution.
A fixed value for the beta parameter regularization strength.
Degrees of freedom for spline basis.
(optional) Initial setting of spline parameters (before optimization)
An integer (typically 0, 1, 2), indicating differencing order for L2 regularization of spline parameters. Default is 2 for second derivative penalty.
Validation time series of equal size to reported vector for use with 'val' method. Default is NULL.
And integer number of steps the spline is defined beyond the final observation.
A flag to use either the Fisher Information (TRUE) or the Hessian (FALSE) to approx posterior covariance over parameters.
An integer for the number of Laplace samples per AR fit.
A list of results of train and validate, including:
train_ll = training log likelihood
val_ll = validation log likelihood (if `reported_val` is not `NULL`)
Isamps = samples of the incidence curve from a Laplace approximation
Ihat = MAP estimate of the incidence curve
Chat = expected cases given MAP incidence curve
beta_hat = MAP estimate of spline parameters
beta_cov = covariance of spline parameters
beta_hess = Hessian of spline parameters