train_and_validate {incidental} | R Documentation |
Train and validate model on reported data
Description
This function fit models with selected hyperparameters on reported data and return a matrix of posterior Laplace samples.
Usage
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
)
Arguments
reported |
An integer vector of reported cases. |
delay_dist |
A positive vector that sums to one, which describes the delay distribution. |
lam |
A fixed value for the beta parameter regularization strength. |
dof |
Degrees of freedom for spline basis. |
beta0 |
(optional) Initial setting of spline parameters (before optimization) |
regularization_order |
An integer (typically 0, 1, 2), indicating differencing order for L2 regularization of spline parameters. Default is 2 for second derivative penalty. |
reported_val |
Validation time series of equal size to reported vector for use with 'val' method. Default is NULL. |
end_pad_size |
And integer number of steps the spline is defined beyond the final observation. |
fisher_approx_cov |
A flag to use either the Fisher Information (TRUE) or the Hessian (FALSE) to approx posterior covariance over parameters. |
num_samps_per_ar |
An integer for the number of Laplace samples per AR fit. |
Value
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