byGroupLOS: Length of stay by groups

Description Usage Arguments Value See Also Examples

View source: R/LOScalcFns.R

Description

Batch calculate all the cumulative hazards, transition probabilites and length of stay for each of the organism groups in turn

Usage

1
byGroupLOS(survData.list, type, standerr = FALSE)

Arguments

survData.list
type

Model type: cause-specific "", subdistribution with discharge alive as event of interest "alive" or subdistribution with in-hospital death as the event of interest "dead".

standerr

Should the standard error be calculated. This may take some minutes.

Value

Returns list of lists. Below initial sample stratification:

mvna.data

Output from mvna contained in mvna

clos.data

Excess length of stay output

se

Bootstrap standard error estimate

etm.data

Output from etm contained in etm

See Also

byGroupLOS.boxplot

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require(mvna)
require(etm)
data(survDataByGender)

foo <- byGroupLOS(survDataByGender,"")
foo$Male$clos.data



## The function is currently defined as
function (survData.list, type, standerr = FALSE) 
{
    startTime <- Sys.time()
    namesGroup <- names(survData.list)
    progressbar <- txtProgressBar(min = 0, max = length(namesGroup), 
        style = 3)
    counter = 0
    tra <- matrix(FALSE, 3, 3, dimnames = list(as.character(0:2), 
        as.character(0:2)))
    tra[1, 2:3] <- TRUE
    tra[2, 3] <- TRUE
    results <- list()
    for (i in namesGroup) {
        counter = counter + 1
        setTxtProgressBar(progressbar, counter)
        if (i == "") {
            stop("no group name")
        }
        if (nrow(survData.list[[i]]) == 0) {
            results[[i]] <- list(NA, NA, NA)
        }
        else {
            results[[i]] <- listLOS(survData.list[[i]], tra, 
                type, standerr)
        }
    }
    close(progressbar)
    cat(Sys.time() - startTime)
    results
  }

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