Defines a list specifying the structure of the approximate Gaussian process. Custom settings can be supplied which override the defaults.

gp_opts(
basis_prop = 0.2,
boundary_scale = 1.5,
ls_mean = 21,
ls_sd = 7,
ls_min = 0,
ls_max = 60,
alpha_sd = 0.05,
kernel = "matern",
matern_type = 3/2
)

Arguments

basis_prop

Numeric, proportion of time points to use as basis functions. Defaults to 0.1. Decreasing this value results in a decrease in accuracy but a faster compute time (with increasing it having the first effect). In general smaller posterior length scales require a higher proportion of basis functions. See (Riutort-Mayol et al. 2020 https://arxiv.org/abs/2004.11408) for advice on updating this default. This setting is an area of active research.

boundary_scale

Numeric, defaults to 1.5. Boundary scale of the approximate Gaussian process. See (Riutort-Mayol et al. 2020 https://arxiv.org/abs/2004.11408) for advice on updating this default.

ls_mean

Numeric, defaults to 21 days. The mean of the lognormal length scale.

ls_sd

Numeric, defaults to 7 days. The standard deviation of the log normal length scale. If ls_sd = 0, inverse-gamma prior on Gaussian process length scale will be used with recommended parameters inv_gamma(1.499007, 0.057277 * ls_max).

ls_min

Numeric, defaults to 0. The minimum value of the length scale.

ls_max

Numeric, defaults to 60. The maximum value of the length scale. Updated in create_gp_data to be the length of the input data if this is smaller.

alpha_sd

Numeric, defaults to 0.05. The standard deviation of the magnitude parameter of the Gaussian process kernel. Should be approximately the expected standard deviation of the logged Rt.

kernel

Character string, the type of kernel required. Currently supporting the squared exponential kernel ("se") and the 3 over 2 Matern kernel ("matern", with matern_type = 3/2). Defaulting to the Matern 3 over 2 kernel as discontinuities are expected in Rt and infections.

matern_type

Numeric, defaults to 3/2. Type of Matern Kernel to use. Currently only the Matern 3/2 kernel is supported.

Value

A list of settings defining the Gaussian process

Examples

# default settings
gp_opts()
#> $basis_prop #> [1] 0.2 #> #>$boundary_scale
#> [1] 1.5
#>
#> $ls_mean #> [1] 21 #> #>$ls_sd
#> [1] 7
#>
#> $ls_min #> [1] 0 #> #>$ls_max
#> [1] 60
#>
#> $alpha_sd #> [1] 0.05 #> #>$kernel
#> [1] "matern_3/2"
#>
#> $matern_type #> [1] 1.5 #> # add a custom length scale gp_opts(ls_mean = 4) #>$basis_prop
#> [1] 0.2
#>
#> $boundary_scale #> [1] 1.5 #> #>$ls_mean
#> [1] 4
#>
#> $ls_sd #> [1] 7 #> #>$ls_min
#> [1] 0
#>
#> $ls_max #> [1] 60 #> #>$alpha_sd
#> [1] 0.05
#>
#> $kernel #> [1] "matern_3/2" #> #>$matern_type
#> [1] 1.5
#>