bets.likelihood: (Profile) Likelihood function

Description Usage Arguments Details Value Examples

View source: R/likelihood_inference.R

Description

(Profile) Likelihood function

Usage

1
2
3
4
5
6
7
8
9
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 {params})

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

 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)

bets.covid19 documentation built on July 2, 2020, 2:14 a.m.