Fit a negative binomial branching process model with maximum likelihood inference via rstan

fit_nbbp_homogenous_ml(
  all_outbreaks,
  censor_geq = rep(NA, length(all_outbreaks)),
  condition_geq = rep(NA, length(all_outbreaks)),
  ci_width = 0.95,
  nboot = 1000,
  run_reps = 10,
  max_tries = 50,
  ci_method = "hybrid",
  seed = NA,
  ...
)

Arguments

all_outbreaks

vector containing the size of each outbreak, including the index case

censor_geq

optional, possibly per-chain, censoring, see details.

condition_geq

optional, possibly per-chain, conditioning on minimum observed chain size, see details in fit_nbbp_homogenous_bayes.

ci_width

target width of the 95% confidence interval (coverage is not guaranteed)

nboot

number of parametric bootstrap replicates used for the 95% CI

run_reps

minimum number of random initializations for checking optimization performance, see details

max_tries

maximum number of random initializations when encountering optimization errors, see details

ci_method

adjusts range of r_eff in which likelihood profiling is done instead of parametric bootstrapping, see details.

seed

if not NA, specifies the first seed used in the first rstan::optimizing call spawned by calling this function. Subsequent calls will modify this seed predictably, ensuring no two analyses use the same seed. If NA, each seed is the result of calling sample.int(.Machine$integer.max, 1), as in rstan::optimizing.

...

further arguments passed to rstan::optimizing.

Value

A list the same as optimizing with the following additional components. $ci: named matrix containing the confidence intervals at the specified width for r_eff and the dispersion parameter. $ci_method: character specifying whether the CI was from the "parametric_bootstrap" or the "likelihood_profile" approach. $convergence: named matrix containing min and max values for r_eff, the dispersion parameter, and the log-likelihood

Details

The likelihood is that used by fit_nbbp_homogenous_bayes.

Unless the user passes initialization information to rstan, rstan's default of random initialization is used. Optimization will be attempted at least run_reps times, with the reported parameters taken from the replicate with the highest log-likelihood. Run-to-run variation is reported as the range of values of the log-likelihood, r_eff, and dispersion. If issues are encountered in optimizing, up to max_tries attempts will be made to obtain run_reps successful replicates. Results will be returned even if no replicate ran without incident. See optimizing for more on the provided return_code.

Confidence intervals are provided, though in testing the coverage may be relatively different from the specified width. The methods applied are not resampling based and thus can provide confidence intervals even if only index cases have been observed. By default, confidence intervals are provided by adaptively choosing between intervals provided by parametric bootstrapping and likelihood profiling (ci_method = "hybrid"), though this can be changed (ci_method = "boot" for parametric bootstrapping, ci_method = "profile" for profiling). The parametric bootstrap has been observed to yield confidence intervals which generally are more consistent in coverage across parameter values than the method of profiling the likelihood surface, except near r_eff = 1, where the coverage is quite bad and profiling the likelihood works better.