clos {etm} | R Documentation |
The function estimates the expected change in length of stay (LOS)
associated with an intermediate event in the same way as does the
clos
function in the changeLOS
package. The difference between the 2 implementations is that this
function can handle left-truncated data, and does not require a
competing outcome.
clos(x, aw = FALSE)
x |
An object of class etm . Argument delta.na in
etm must be set to TRUE in order to use this
function. |
aw |
Logical. Whether to compute the expected change of LOS using
alternative weighting. Default is FALSE . |
See clos
for more details on the method
An object of class clos.etm
with the following components:
e.phi |
Change in length of stay |
phi.case |
Estimates of E(LOS | X_s = intermediate event) for all observed transition times s, where X_sdenotes the state by time s |
phi.control |
Estimates of E(LOS|X_s = initial state) for all observed transition times s. |
e.phi2 |
Weighted average of the difference between
phi2.case and phi2.control . |
phi2.case |
Estimates of E(LOS 1(X_LOS = discharge)|X_s = intermediate event), where 1 denotes the indicator function. |
phi2.control |
E(LOS 1(X_LOS = discharge)|X_s = initial state). |
e.phi3 |
Weighted average of the difference between
phi3.case and phi3.control . |
phi3.case |
Estimates of E(LOS 1(X_LOS = death)|X_s = intermediate event). |
phi3.control |
E(LOS 1(X_LOS = death)|X_s = initial state). |
weights |
Weights used to compute the weighted averages. |
w.time |
Times at which the weights are computed. |
time |
All transition times. |
e.phi.weights.1 |
Expected change in LOS using weights.1 |
e.phi.weights.other |
Expected change in LOS using
weights.other |
weights.1 |
Weights corresponding to the conditional waiting time in the intial state given one experiences the intermediate event. |
weights.other |
Weights corresponding to the conditional waiting time given one does not experience the intermediate event. |
Arthur Allignol arthur.allignol@fdm.uni-freiburg.de, Matthias Wangler, Jan Beyersmann
require(changeLOS) data(los.data) # in package changeLOS ## putting los.data in the long format (see changeLOS) my.observ <- prepare.los.data(x=los.data) tra <- matrix(FALSE, 4, 4) tra[1, 2:4] <- TRUE tra[2, 3:4] <- TRUE tr.prob <- etm(my.observ, c("0","1","2","3"), tra, NULL, 0) cLOS <- etm::clos(tr.prob) plot(cLOS) ### Compute bootstrapped SE ## function that performs the bootstrap ## nboot: number of bootstrap samples. Other arguments are as in etm() boot.clos <- function(data, state.names, tra, cens.name, s = 0, nboot) { res <- double(nboot) for (i in seq_len(nboot)) { index <- sample(unique(data$id), replace = TRUE) inds <- new.id <- NULL for (j in seq_along(index)){ ind <- which(data$id == index[j]) new.id <- c(new.id, rep(j, length(ind))) inds <- c(inds, ind) } dboot <- cbind(data[inds, ], new.id) dboot[, which(names(dboot) == "id")] dboot$id <- dboot$new.id tr.prob <- etm(dboot, state.names, tra, cens.name, s, cova = FALSE) res[i] <- etm::clos(tr.prob)$e.phi } res } ## bootstrap se <- sqrt(var(boot.clos(my.observ, c("0","1","2","3"), tra, NULL, 0, nboot = 10)))