calculate_CI_I_pp {prevtoinc}R Documentation

Calculate confidence intervals for Grenander estimator of Ipp based on asymptotics

Description

Asymptotic or bootstrap approximation of confidence intervals for estimates of Ipp with gren method Can use output of calculate_I_* functions as input. The asymptotic method uses the asymptotic normality of the estimator of I.pp to calculate the confidence interval and the method "bs" uses a parametric bootstrap approximation based on the "naive" estimator.

Usage

calculate_CI_I_pp(data, method = "asymptotic", alpha = 0.05,
  n_bs = 10000)

Arguments

data

data frame which contains at least the following columns

  • n - number of patients sampled

  • n.noso - number of HAIs

  • P.hat - estimate of prevalence P

  • x.loi.hat - estimate of x.loi

  • x.los.hat - estimate of x.los

  • I.pp.hat - estimate of incidence proportion per admission I.pp

method

either "asymptotic" for asymptotic confidence interval or "bs" for bootstrap-based confidence interval

alpha

confidence level

n_bs

number of bootstrap replications if method is "bs"

Value

tibble with columns CI.lower.Ipp and CI.upper.Ipp

Examples


example.dist <- create_dist_vec(function(x) dpois(x-1, 7), max.dist = 70)
example.dist.los <- create_dist_vec(function(x) dpois(x-1, lambda = 12),
                                    max.dist = 70)
data.pps.fast <- simulate_pps_fast(n.sample=5000,
                                   P=0.05,
                                   dist.X.loi = example.dist,
                                   dist.X.los = example.dist.los)
gren_est <- calculate_I_smooth(data = data.pps.fast, method = "gren")
gren_est
calculate_CI_I_pp(gren_est, method = "asymptotic", alpha = 0.05)


[Package prevtoinc version 0.12.0 Index]