simulate_incidence_stats: Calculate theoretical values like x.los, x.loi and other...

View source: R/simulationsfunctions.R

simulate_incidence_statsR Documentation

Calculate theoretical values like x.los, x.loi and other characteristics of the patient population

Description

Calculate theoretical values like x.los, x.loi and other characteristics of the patient population

Usage

simulate_incidence_stats(hospital, steps = 365 * 10000, n.sim.pat = 5000)

Arguments

hospital

type of hospital as a list-object (see vignette for details)

steps

number of steps to evolve process

n.sim.pat

size of simulations to estimate individual characteristics of patients

Value

list with following components

  • x.los - average length of stay x_{los}

  • x.loi - average length of infection x_{loi}

  • x.los.noso.only - average length of stay for patients with HAI

  • x.los.wo.noso - average length of stay for patients discounting time with HAI

  • I - theoretical incidence rate per patient day

  • I.pp - list of theoretical incidences for patient types

  • patient.stats - list with 'x.los' and 'x.loi' for different patient types

  • patient.risk.times - list of patient days at risk for different patient types

Examples

pat.1 <- list(dist.X.los = create_dist_vec(
                               function(x) dpois(x-1, lambda = 12), 70),
I.p = 0.008,
dist.X.loi = create_dist_vec(function(x) dpois(x-1, lambda = 10), 70))

pat.2 <- list(dist.X.los = 
                create_dist_vec(function(x) dpois(x-1, lambda = 10), 70),
              I.p = 0.02,
              dist.X.loi = 
                create_dist_vec(function(x) dpois(x-1, lambda = 7), 70))

patient.list <- list(pat.1, pat.2)


# define distribution of patients
pat.1.prob <- 0.4; pat.2.prob <- 0.6
pat.dist.hosp <- c(pat.1.prob, pat.2.prob)
hospital.1 <- list(inc.factor = 1,
                   pat.dist = pat.dist.hosp,
                   patient.list = patient.list)
data.pps <- simulate_pps_data(n.sample=1000, steps=200, hospital=hospital.1) 
data.inc.theo <- simulate_incidence_stats(hospital.1, 365 * 1000)
# gives incidence rate I
data.inc.theo$I
# gives incidence proportion per admission
data.inc.theo$I.pp

prevtoinc documentation built on Sept. 3, 2026, 5:07 p.m.