Skip to contents

This function estimates the serial interval using the Expectation-Maximization (EM) algorithm.

Usage

si_estim(dat, n = 50, dist = "normal", init = NULL)

Arguments

dat

vector; a numeric vector of index case to case intervals

n

integer; number of iterations for EM algorithm; defaults to n = 50

dist

string; assumed distribution of the serial interval; takes "normal" or "gamma"; defaults to "normal".

init

numeric vector of length 2 specifying the initial values to use for the mean and standard deviation. If init= NULL, then the sample mean and sample standard deviation each divided by 4 is used.

Value

vector with estimates for the mean and standard deviation of the primary-secondary infection component

Examples

my_data<-c(rep(1,38),rep(2,39),rep(3,30),rep(4,17),rep(5,7))

si_estim(my_data)
#> $mean
#> [1] 2.23948
#> 
#> $sd
#> [1] 0.7980139
#> 
#> $wts
#> [1] 3.023907e-01 4.390443e-01 2.644476e-04 2.223004e-01 4.091187e-06
#> [6] 3.599603e-02 6.804838e-08
#>