Description Usage Arguments Details Value Examples
View source: R/likelihood_inference.R
(Profile) Likelihood function
1 2 3 4 5 6 7 8 9 |
params |
A vector of parameters (with at least one of the following entries: rho, r, ip_q50, ip_q95) |
data |
A data frame with three columns: B, E, S |
likelihood |
Use the conditional or unconditional likelihood function |
M |
Right truncation for symptom onset |
r |
Parameter for epidemic growth (overrides |
L |
Day of travel quarantine |
params_init |
Initial parameters for computing the profile likelihood |
Non-default values of M
and r
are only available for conditional likelihood.
Log-likelihood function if params
has all four entries, rho, r, ip_q50, ip_q95 (or three entires—r, ip_q50, ip_q95—if computing the conditional likelihood). Otherwise returns the profile likelihood for the parameters in params
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | data(wuhan_exported)
data <- wuhan_exported
data$B <- data$B - 0.75
data$E <- data$E - 0.25
data$S <- data$S - 0.5
params <- c(r = 0.2,
ip_q50 = 5,
ip_q95 = 12)
# Conditional likelihood
bets.likelihood(params, data)
# Conditional likelihood with right truncation
bets.likelihood(params, subset(data, S <= 60), M = 60)
# Conditional likelihood with fixed r (not recommended)
bets.likelihood(params, data, r = 0)
# Unconditional likelihood
params["rho"] <- 1
bets.likelihood(params, data, likelihood = "unconditional", L = 54)
# Profile conditional likelihood
bets.likelihood(c(r = 0.2), data, params_init = params)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.