bets.likelihood {bets.covid19} | R Documentation |
(Profile) Likelihood function
Description
(Profile) Likelihood function
Usage
bets.likelihood(
params,
data,
likelihood = c("conditional", "unconditional"),
M = Inf,
r = NULL,
L = NULL,
params_init = NULL
)
Arguments
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 |
Details
Non-default values of M
and r
are only available for conditional likelihood.
Value
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
.
Examples
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)
[Package bets.covid19 version 1.0.0 Index]