Description Usage Arguments Value

This function fit models with selected hyperparameters on reported data and return a matrix of posterior Laplace samples.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
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
)
``` |

`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. |

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.