simulate_pps_fast {prevtoinc} | R Documentation |
Faster method to generate data for PPS with only length of nosocomial infections as output
Description
The function 'simulate_pps_fast' can be used to generate PPS data. This functions simulates a PPS on the basis of a given prevalence 'P' using a vector of probabilities 'dist.X.loi' for the values 1:length(dist.X.loi) of X.loi. It directly samples the time of infection up to date based on 'dist.X.loi'. Optionally, the length of stay is sampled independently ( treating the marginal distributions of length of stay and length of infection as independent by assumption) using 'dist.X.los' which is in the same format as 'dist.X.loi'. Because of this non-joint sampling rows should not be interpreted as individual patients.
Usage
simulate_pps_fast(n.sample, P, dist.X.loi, dist.X.los = NA,
one.factor.loi = 1, one.factor.los = 1)
Arguments
n.sample |
number of beds to simulate |
P |
prevalence of nosocomial infections |
dist.X.loi |
vector of probabilities for values 1:length(dist.X.loi) of X.loi |
dist.X.los |
vector of probabilities for values 1:length(dist.X.los) of X.los |
one.factor.loi |
factor by which to approx. reduce number of one day observations for A.loi |
one.factor.los |
factor by which to approx. reduce number of one day observations for A.los |
Value
data frame with a row for a each simulated patient and the following columns
A.loi - length of infection up to PPS
L.loi - total length of infection
A.los - length of stay up to PPS
L.los - total length of stay
patient.type - patient type (fixed to 1 for fast method)
Examples
example.dist <- create_dist_vec(function(x) dpois(x-1, 7), 70)
data.pps.fast <- simulate_pps_fast(n.sample=5000,
P=0.05,
dist.X.loi = example.dist)
head(data.pps.fast)