trprob_trcov: Function to extract transition probabilities and (co)variance

Description Usage Arguments Value Author(s) See Also Examples

Description

The trprob method is used to extract transition probabilities, while trcov is used to obtain the (co)variance.

Usage

1
2
3
4
## S3 method for class 'etm'
trprob(x, tr.choice, timepoints, ...)
## S3 method for class 'etm'
trcov(x, tr.choice, timepoints, ...)

Arguments

x

An object of class etm.

tr.choice

A character vector of the form "from to" describing for which transition one wishes to obtain the transition probabilities or covariance estimates. For trprob, tr.choice must be of length 1, while it can be of length 2 for trcov.

timepoints

Time points at which one want the estimates. When missing, estimates are obtained for all event times.

...

Further arguments.

Value

A vector containing the transition probabilities or covariance estimates either at the time specified in timepoints or at all transition times.

Author(s)

Arthur Allignol, arthur.allignol@gmail.com

See Also

etm

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
data(sir.cont)

# Modification for patients entering and leaving a state
# at the same date
# Change on ventilation status is considered
# to happen before end of hospital stay
sir.cont <- sir.cont[order(sir.cont$id, sir.cont$time), ]
for (i in 2:nrow(sir.cont)) {
  if (sir.cont$id[i]==sir.cont$id[i-1]) {
    if (sir.cont$time[i]==sir.cont$time[i-1]) {
      sir.cont$time[i-1] <- sir.cont$time[i-1] - 0.5
    }
  }
}

### Computation of the transition probabilities
# Possible transitions.
tra <- matrix(ncol=3,nrow=3,FALSE)
tra[1, 2:3] <- TRUE
tra[2, c(1, 3)] <- TRUE

# etm
fit.etm <- etm(sir.cont, c("0", "1", "2"), tra, "cens", 0)

## extract P_01(0, t) and variance
p01 <- trprob(fit.etm, "0 1")
var.p01 <- trcov(fit.etm, "0 1")

## covariance between P_00 and P_01
cov.00.01 <- trcov(fit.etm, c("0 0", "0 1"))

## P_01 at some time points
trprob(fit.etm, "0 1", c(0, 15, 50, 100))

etm documentation built on Sept. 8, 2020, 5:06 p.m.