Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of alpha #831

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions R/opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,13 @@ backcalc_opts <- function(prior = c("reports", "none", "infections"),
#' this is smaller.
#'
#' @param alpha_mean Numeric, defaults to 0. The mean of the magnitude parameter
#' of the Gaussian process kernel. Should be approximately the expected variance
#' of the logged Rt.
#' of the Gaussian process kernel. Should be approximately the expected standard
#' deviation of the Gaussian process (logged Rt in case of the renewal model,
#' logged infections in case of the nonmechanistic model).
#'
#' @param alpha_sd Numeric, defaults to 0.01. The standard deviation of the
#' magnitude parameter of the Gaussian process kernel. Should be approximately
#' the expected standard deviation of the logged Rt.
#' @param alpha_sd Numeric, defaults to 0.1. The standard deviation of the
#' magnitude parameter of the Gaussian process kernel. Can be tuned to adjust
#' how far alpha is allowed to deviate form its prior mean (`alpha_mean`).
#'
#' @param kernel Character string, the type of kernel required. Currently
#' supporting the Matern kernel ("matern"), squared exponential kernel ("se"),
Expand Down
11 changes: 6 additions & 5 deletions man/gp_opts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions vignettes/gaussian_process_implementation_details.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,22 @@ with the following choices available for the kernel $k$
## Matérn 3/2 covariance kernel (the default)

\begin{equation}
k(\Delta t) = \alpha \left( 1 + \frac{\sqrt{3} \Delta t}{l} \right) \exp \left( - \frac{\sqrt{3} \Delta t}{l}\right)
k(\Delta t) = \alpha^2 \left( 1 + \frac{\sqrt{3} \Delta t}{l} \right) \exp \left( - \frac{\sqrt{3} \Delta t}{l}\right)
\end{equation}

with $l>0$ and $\alpha > 0$ the length scale and magnitude, respectively, of the kernel.
Note that here and later we use a slightly different definition of $\alpha$ compared to Riutort-Mayol et al. [@approxGP], where this is defined as our $\alpha^2$.

## Squared exponential kernel

\begin{equation}
k(\Delta t) = \alpha \exp \left( - \frac{1}{2} \frac{(\Delta t^2)}{l^2} \right)
k(\Delta t) = \alpha^2 \exp \left( - \frac{1}{2} \frac{(\Delta t^2)}{l^2} \right)
\end{equation}

## Ornstein-Uhlenbeck (Matérn 1/2) kernel

\begin{equation}
k(\Delta t) = \alpha \exp{\left( - \frac{\Delta t}{2 l^2} \right)}
k(\Delta t) = \alpha^2 \exp{\left( - \frac{\Delta t}{2 l^2} \right)}
\end{equation}

## Matérn 5/2 covariance kernel
Expand Down Expand Up @@ -120,7 +121,7 @@ t^* = \frac{t - \frac{1}{2}t_\mathrm{GP}}{\frac{1}{2}t_\mathrm{GP}}
Relevant priors are

\begin{align}
\alpha &\sim \mathcal{Normal}(0, \sigma_{\alpha}) \\
\alpha &\sim \mathcal{Normal}(\mu_\alpha, \sigma_{\alpha}) \\
\rho &\sim \mathcal{LogNormal} (\mu_\rho, \sigma_\rho)\\
\end{align}

Expand All @@ -133,7 +134,8 @@ m_\rho &= 21 \\
s_\rho &= 7 \\
\rho_\mathrm{min} &= 0\\
\rho_\mathrm{max} &= 60\\
\sigma_\alpha &= 0.05\\
\mu_\alpha &= 0\\
\sigma_\alpha &= 0.01
\end{align}

# References
Loading