estimate_beta_FC: Estimate time-varying transmission rates (FC method)

Description Usage Arguments Value Mock birth data Missing data Effective observation interval References Examples

View source: R/estimate_beta_FC.R

Description

estimate_beta_FC() applies the FC method (see References) to estimate the time-varying transmission rate β(t) from time series of reported incidence and births, observed at equally spaced time points tk = t0+kΔt (for k = 0,...,n), where Δt denotes the observation interval.

Usage

1
estimate_beta_FC(df = data.frame(), par_list = list())

Arguments

df

A data frame with numeric columns:

t

Time. t[i] is equal to ti−1 = t0+(i−1)Δt in units Δt, so that t[i] - t[i-1] is equal to 1.

C

Reported incidence. C[i] is the number of cases reported between times t[i-1] and t[i].

B

Births. B[i] is the number of births between times t[i-1] and t[i].

B is optional if hatN0 and nu are defined in par_list (see Details).

par_list

A list containing:

prep

[ prep ] Case reporting probability.

trep

[ trep ] Case reporting delay in units Δt.

S0

[ S0 ] Number of susceptibles at time t = t0.

hatN0

[ Ñ0 ] Population size at time t = 0 years.

nu

[ νc ] Birth rate expressed per unit Δt and relative to Ñ0 (if modeled as constant).

tgen

[ tgen ] Mean generation interval of the disease of interest in units Δt.

hatN0 and nu are optional if B is defined in df (see Details).

Value

A data frame with numeric columns:

t

Time. Identical to df$t.

C

Reported incidence, imputed. Identical to df$C, except with missing values and zeros imputed (see Details).

Z

Incidence. Z[i] is the estimated number of infections between times t[i-1] and t[i].

Z_agg

Aggregated incidence. Z_agg[i] is the estimated number of infections between times t[i-round(tgen)+1] and t[i], for i in seq(1 + round(tgen), nrow(df), by = round(tgen)). Z_agg[i] is NA otherwise.

B

Births, imputed. Identical to df$B (if supplied), except with missing values imputed (see Details).

B_agg

Aggregated births. B_agg[i] is the number of births between times t[i-round(tgen)+1] and t[i], for i in seq(1 + round(tgen), nrow(df), by = round(tgen)). B_agg[i] is NA otherwise.

S

Number of susceptibles. S[i] is the estimated number of susceptibles at time t[i].

I

Number of infecteds. I[i] is the estimated number of infecteds at time t[i].

beta

Transmission rate. beta[i] is the estimated transmission rate at time t[i] expressed per unit Δt per susceptible per infected.

It possesses par_list as an attribute.

Mock birth data

If df$B is undefined in the function call, then df$B[i] gets the value with(par_list, nu * hatN0 * 1) for all i.

Missing data

Missing values in df[, c("C", "B")] are not tolerated by the FC method. They are imputed via linear interpolation between observed values. If there are no observations before the first missing value, then complete imputation is impossible. In this case, the FC method may fail: columns S and beta in the output may be filled with NA.

Zeros in df$C cause divide-by-zero errors. To prevent these errors, zeros are imputed like missing values. If there are no nonzero observations before the first zero, then complete imputation is impossible. In this case, the FC method may fail, but only locally: column beta in the output may contain some NaN and Inf where an estimate would otherwise be expected. (Estimates are not expected everywhere. See "Effective observation interval".)

Effective observation interval

In the output, every with(par_list, round(tgen)) rows are complete. The remaining rows contain NA in columns S, I, beta, Z_agg, and B_agg. This is a limitation of the FC method, which aggregates incidence and births over the mean generation interval, making with(par_list, round(tgen)) the effective observation interval. If this number is zero, then the method fails.

References

deJonge MS, Jagan M, Krylova O, Earn DJD. Fast estimation of time-varying transmission rates for infectious diseases.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Simulate a reported incidence time series using
# a seasonally forced transmission rate
par_list <- make_par_list(dt_weeks = 1)
df <- make_data(
  par_list = par_list,
  n = 20 * 365 / 7, # 20 years is ~1042 weeks
  with_dem_stoch = FALSE
)
head(df)

# Estimate incidence, susceptibles, infecteds,
# and the seasonally forced transmission rate
df_FC <- estimate_beta_FC(df, par_list)
head(df_FC)

# Estimation of susceptibles and transmission rate fails
# because the FC method ignores susceptible mortality
df_FC$t_years <- df$t_years
plot(S ~ t_years, df, type = "l", ylim = c(43, 83) * 1e03)
lines(S ~ t_years, df_FC[!is.na(df_FC$S), ], col = "red")
plot(beta ~ t_years, df, type = "l", ylim = c(0.5, 1.2) * 1e-05)
lines(beta ~ t_years, df_FC[!is.na(df_FC$beta), ], col = "red")

davidearn/fastbeta documentation built on June 14, 2020, 3:11 p.m.