listLOS: Length of stay multistate model statistics

Description Usage Arguments Examples

View source: R/LOScalcFns.R

Description

Calculate length of stay multistate model statistics.

Usage

1
listLOS(survData, tra, type, standerr = FALSE, trim = 0.99)

Arguments

survData
tra

Transition matrix of permitted direct between state jumps.

type

Model type, either cause-specific, subsdistribution with discharge alive as event of interest or in-hospital death as event of interest.

standerr

Logical, whether the standard error should be calculated.

trim

Upper percentile of data to trim.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (survData, tra, type, standerr = FALSE, trim = 0.99) 
{
    tsurvData <- survData
    msm.data <- etmFormat(tsurvData, type)
    mvna.data <- mvna::mvna(data = msm.data, state.names = c("0", 
        "1", "2"), tra = tra, cens.name = "cens")
    etm.data <- etm::etm(data = msm.data, state.names = c("0", 
        "1", "2"), tra = tra, cens.name = "cens", s = 0)
    clos.data <- etm::clos(etm.data, aw = TRUE)
    if (standerr) {
        se <- sqrt(var(boot.clos(data = msm.data, state.names = c("0", 
            "1", "2"), tra = tra, cens.name = "cens", 0, nboot = 10)))
    }
    else {
        se <- 0
    }
    list(mvna.data = mvna.data, clos.data = clos.data, se = se, 
        etm.data = etm.data)
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.