clos {changeLOS} | R Documentation |
estimates the expected change in length of stay (LOS) associated with an intermediate event (IE). In order to account for the timing of events (an IE can only have an effect once it has occurred), a multi-state model is used. The data are stratified into `cases' (the IE has occurred) and `controls' (the IE has not yet occurred) on a daywise basis. (`Daywise' if time is in days.) The expected change in LOS is estimated for each day and a weighted average is computed.
clos(model, observ, aw=FALSE)
model |
an object of the class 'msmodel' which describes the multi-state model |
observ |
a data.frame of the form data.frame( id, from, to, time, oid )
(see also prepare.los.data ):
|
aw |
locical, with (TRUE) or without(FALSE) alternative weighting |
clos
is based on `approach B' in Schulgen and Schumacher
(1996), however with some modifications: We use a multi-state model
with four states. All individuals start in an initial state. They may
pass through the intermediate state. LOS is determined by reaching one
of two competing, absorbing states. In clinical research these latter
two states are typically `discharge' and `death',
respectively. The IE is often interpreted as a complication. Backward
transitions are not possible. Schulgen and
Schumacher
(1996) modelled a second intermediate state, motivated by their
application. However, this model has some individuals `drop out' in
the sense that they become neither `case' nor `control'. In addition,
clos
computes an weighted average,
where the weights are given by the weighting time distribution in the
intial state. Schulgen and Schumacher (1996) used a conditional version
of it, given one reaches the IE. In the case of no censoring, the
former weights have every individual contribute to the weighting,
whereas the latter has not. One can interpret the conditional
weighting in Schulgen and Schumacher (1996) as assuming a
patient's viewpoint who experiences the IE (and analogously for
patients uninfected,
with weights given one is directly discharged/dies without prior IE.)
Finally, clos
treats the daywise
comparison as being zero if there are not both patients with and
without IE on that day.
See also Beyersmann et al. (2005) for a non-technical explanation of
these methods.
See the examples for special features:
An object of class c('clos'). The object is a list of
cLOS |
change in LOS |
trans |
an object of class 'trans' |
e.given.1 |
estimates E(LOS|X_s = intermediate event) for all observed transition times s, where X_s denotes the state by time s |
e.given.0 |
estimates E(LOS|X_s = initial state) for all observed transition times s, where X_s denotes the state by time s |
phi2 |
weighted average of the difference between phi2.case and phi2.control, this quantity can be interpreted as the contribution to the expected change in LOS at time s by patients infected at time s who eventually discharge |
phi2.case |
estimates E(LOS 1(X_LOS = discharge)|X_s = intermediate event), where 1 denotes the indicator function |
phi2.control |
P(X_LOS = discharge|X_s = intermediate event) E(LOS|X_s = initial state) |
phi3 |
weighted average of the difference between phi3.case and phi3.control, this quantity can be interpreted as the contribution to the expected change in LOS at time s by patients infected at time s who eventually die |
phi3.case |
estimates E(LOS 1(X_LOS = death)|X_s = intermediate event), where 1 denotes the indicator function |
phi3.control |
P(X_LOS = death|X_s = intermediate event) E(LOS|X_s = initial state) |
empty.1 |
event times with the group `intermediate, but no terminal event yet' being empty |
empty.0 |
event times with the group `no intermediate or terminal event yet' being empty |
weights |
weights for the weighted average |
w.times |
time points corresponding to the weights |
called |
how the function was called |
patients |
total number of observed patients |
patients.discharge |
number of patients being discharged |
patients.death |
number of patients who die |
patients.cens |
number of patients being censored, i. e. for whom neither discharge or death was observed |
cases |
number of patients who experienced the IE |
cases.discharge |
number of patients who experienced the IE being discharged |
cases.death |
number of patients who experienced the IE and died |
cases.cens |
number of patients who experienced the IE and were censored |
When aw=TRUE an object of class c('clos','closa'). The object is a list like above with the following extra items:
required packages: survival
Jan Beyersmann jan@fdm.uni-freiburg.de Matthias Wangler mw@imbi.uni-freiburg.de
G Schulgen and M Schumacher (1996). Estimation of prolongation of hospital stay attributable to nosocomial infections. Lifetime Data Analysis 2, 219-240.
J Beyersmann, P Gastmeier, H Grundmann, S Baerwolf, C Geffers, M Behnke, H Rueden, and M Schumacher (2006). Use of Multistate Models to Assess Prolongation of Intensive Care Unit Stay Due to Nosocomial Infection. Infection Control and Hospital Epidemiology 27, 493-499.
M Wrangler, J Beyersmann and M Schumacher (2006). changeLOS: An R-package for change in length of hospital stay based on the Aalen-Johansen estimator. R News 6(2), 31–35.
A reference on multi-state models:
P Andersen and N Keiding (2002). Multi-state models for event history analysis. Statistical Methods in Medical Research 11, 91-115
## run clos data(los.data) my.observ <- prepare.los.data(x=los.data) tra <- matrix(FALSE,4,4) diag(tra) <- TRUE tra[1,] <- TRUE tra[2,3:4] <- TRUE my.model <- msmodel(c("0","1","2","3"),tra,cens.name="cens") los <- clos(model=my.model,observ=my.observ) summary(los) plot(los) ## expected change in LOS due to an IE phi <- los$e.given.1 - los$e.given.0 ## distinguishing between patients discharged phi2 <- los$phi2.case - los$phi2.control ## and patients deceased phi3 <- los$phi3.case - los$phi3.control ## we have phi = phi2 + phi3 all(round(phi, digits=10) == round(phi2+phi3, digits=10),na.rm=TRUE) ## compute bootstrap SE with function boot() from library boot ## first we need a statistic, which boot takes as an argument "clos.for.bstrap" <- function(data, index, mod){ my.observ <- prepare.los.data(x=data[index,]) return(clos(model=mod,observ=my.observ)$cLOS) } ## our estimate is clos.for.bstrap(data=los.data, index=1:length(los.data[,1]), mod=my.model) ## now bootstrap library(boot) nb <- 20 ## nb <- 2000 los.bootstrap <- boot(los.data, clos.for.bstrap, nb, mod=my.model) sqrt(var(los.bootstrap$t)) ## compute change in LOS `by hand'; also works for alternative weights ## first, get pure event times my.evtimes <- sort(unique(my.observ$time[my.observ$to !="cens"])) ## compute daywise difference between expected LOS my.diffs <- los$e.given.1 - los$e.given.0 ## restrict to those days when a transition out of the initial state was observed my.diffs <- my.diffs[is.element(my.evtimes, los$w.times)] ## compute weighted average, but don't sum up over ## days where one of the groups (no) IE (yet) experienced was empty. sum((my.diffs * los$weights)[!(is.element(los$w.times, c(los$empty.0, los$empty.1)))])