closPseudo {etm}R Documentation

Pseudo Value Regression for the Extra Length-of-Stay

Description

Pseudo Value Regression for the Extra Length-of-Stay

Usage

closPseudo(data, state.names, tra, cens.name, s = 0,
           formula, na.action,
           aw = FALSE, ratio = FALSE,
           ncores = 1,
           trick_ties = FALSE)

Arguments

data

data.frame of the form data.frame(id,from,to,time) or (id,from,to,entry,exit)

id:

patient id

from:

the state from where the transition occurs

to:

the state to which a transition occurs

time:

time when a transition occurs

entry:

entry time in a state

exit:

exit time from a state

state.names

A vector of characters giving the states names.

tra

A quadratic matrix of logical values describing the possible transitions within the multistate model.

cens.name

A character giving the code for censored observations in the column 'to' of data. If there is no censored observations in your data, put 'NULL'.

s

Starting value for computing the transition probabilities.

formula

A formula with the covariates at the right of a ~ operator. Leave the left part empty.

na.action

A function which indicates what should happen when the data contain 'NA's. The default is set by the 'na.action' setting of 'options', and is 'na.fail' if that is unset. The 'factory-fresh' default is 'na.omit'.

aw

Logical. Whether to compute the expected change of LOS using alternative weighting. Default is FALSE.

ratio

Logical. Compute the ratio of the expected length-of-stay given instermediate event status instead of a difference. Default value is FALSE

ncores

Number of cores used if doing parallel computation using the parallel package

trick_ties

If TRUE, pseudo values are computed only one per subject sharing the same entry, exit times / transition types.

Details

The function calculates the pseudo-observations for the extra length-of-stay for each individual. These pseudo-observations can then be used to fit a direct regression model using generalized estimating equation (e.g., package geepack).

Computation of the pseudo-observations can be parallelised using the mclapply function of the parallel package. See argument ncores.

Recent versions of R have changed the data.frame function, where the default for the stringsAsFactors argument from TRUE to FALSE. etm currently depends on the states being factors, so that the user should use data.frame(..., stringsAsFactors=TRUE).

Value

An object of class closPseudo with the following components:

pseudoData

a data.frame containing id, computed pseudo values (see details) and the covariates as specified in the formula

theta

Estimates of excess LoS in the whole sample

aw

like in the function call

call

Function call

Author(s)

Arthur Allignol arthur.allignol@gmail.com

References

Andersen, P.K, Klein, J.P, Rosthoj, S. (2003). Generalised linear models for correlated pseudo-observations, with applications to multi-state models. Biometrika, 90(1):15–27.

See Also

mclapply, clos

Examples

if(require("kmi", quietly = TRUE)) {

    ## data in kmi package
    data(icu.pneu)
    my.icu.pneu <- icu.pneu
    
    my.icu.pneu <- my.icu.pneu[order(my.icu.pneu$id, my.icu.pneu$start), ]
    masque <- diff(my.icu.pneu$id)
    
    my.icu.pneu$from <- 0
    my.icu.pneu$from[c(1, masque) == 0] <- 1
    
    my.icu.pneu$to2 <- my.icu.pneu$event
    my.icu.pneu$to2[my.icu.pneu$status == 0] <- "cens"
    my.icu.pneu$to2[c(masque, 1) == 0] <- 1
    
    
    my.icu.pneu$to <- ifelse(my.icu.pneu$to2 %in% c(2, 3), 2,
                             my.icu.pneu$to2)

    my.icu.pneu <- my.icu.pneu[, c("id", "start", "stop", "from", "to",
                                   "to2", "age", "sex")]
    names(my.icu.pneu)[c(2, 3)] <- c("entry", "exit")

    ## computation of the pseudo-observations
    ## Not run: 
        ps.icu.pneu <- closPseudo(my.icu.pneu, c("0", "1", "2"), tra_ill(), "cens",
                                  formula = ~ sex + age)
        
        ## regression model using geepack
        require(geepack)
        fit <- geeglm(ps.e.phi ~ sex + age, id = id, data = ps.icu.pneu$pseudoData,
                      family = gaussian)
        
        summary(fit)
    
## End(Not run)
} else {
    print("This example requires the kmi package")
}

[Package etm version 1.1.1 Index]