Gaussian Process implementation details
Source:vignettes/gaussian_process_implementation_details.Rmd
gaussian_process_implementation_details.Rmd
Overview
We make use of Gaussian Processes in several places in
EpiNow2
. For example, the default model for
estimate_infections()
uses a Gaussian Process to model the
1st order difference on the log scale of the reproduction number. This
vignette describes the implementation details of the approximate
Gaussian Process used in EpiNow2
.
Definition
The single dimension Gaussian Processes () we use can be written as
where and are the mean and covariance functions, respectively. In our case as set out above, we have
$$\begin{equation} \mu(t) \equiv 0 \\ k(t,t') = k(|t - t'|) = k(\Delta t) \end{equation}$$
where by default is a Matern 3/2 covariance kernel,
with and the length scale and magnitude, respectively, of the kernel. Alternatively, a squared exponential kernel can be chosen to constrain the GP to be smoother.
Hilbert space approximation
In order to make our models computationally tractable, we approximate the Gaussian Process using a Hilbert space approximation to the Gaussian Process[1], centered around mean zero.
with the number of basis functions to use in the approximation, which we calculate from the number of time points to which the Gaussian Process is being applied (rounded up to give an integer value), as is recommended[1].
and values of given by
where is a positive number termed boundary condition, and are regression weights with standard normal prior
The function
is the spectral density relating to a particular covariance function
.
In the case of the Matern 3/2 kernel (the default in
EpiNow2
) this is given by
and in the case of a squared exponential kernel by
The functions are the eigenfunctions of the Laplace operator,
with time rescaled linearly to be between -1 and 1,
Relevant priors are
with additionally constrained to be between and , and calculated from given mean and standard deviation , and default values (all of which can be changed by the user):