LR.test {markovMSM}R Documentation

Log-rank based test for the validity of the Markov assumption.

Description

Function LR.test performs the log-rank test described in Titman & Putter (2020).

Usage

LR.test(
  data,
  times = times,
  from,
  to,
  replicas = 1000,
  formula = NULL,
  fn = list(function(x) mean(abs(x), na.rm = TRUE)),
  fn2 = list(function(x) mean(x, na.rm = TRUE)),
  min_time = 0,
  other_weights = NULL,
  dist = c("poisson", "normal")
)

Arguments

data

Multi-state data in msdata format. Should also contain (dummy codings of) the relevant covariates; no factors allowed.

times

Grid of time points at which to compute the statistic.

from

The starting state of the transition to check the Markov condition.

to

The last state of the considered transition to check the Markov condition.

replicas

Number of wild bootstrap replications to perform.

formula

Right-hand side of the formula. If NULL will fit with no covariates (formula="1" will also work), offset terms can also be specified.

fn

A list of summary functions to be applied to the individual zbar traces (or a list of lists)

fn2

A list of summary functions to be applied to the overall chi-squared trace

min_time

The minimum time for calculating optimal weights

other_weights

Other (than optimal) weights can be specified here

dist

Distribution of wild bootstrap random weights, either "poisson" for centred Poisson (default), or "normal" for standard normal

Value

LR.test returns an object of class "markovMSM", which is a list with the following items:

localTestLR

p-value of AUC local tests for each times and transitions.

globalTestLR

p-value of AUC global tests for each transition

times

Grid of time points at which to compute the statistic.

replicas

Number of wild bootstrap replications to perform.

call

Expression of the LR.test used.

Author(s)

Gustavo Soutinho and Luis Meira-Machado.

References

Titman AC, Putter H (2020). General tests of the Markov property in multi-state models. Biostatistics.

Examples


set.seed(1234)
library(markovMSM)
data("colonMSM")
positions<-list(c(2, 3), c(3), c())
namesStates =  c("Alive", "Rec",  "Death")
tmat <-transMatMSM(positions, namesStates)
timesNames = c(NA, "time1","Stime")
status=c(NA, "event1","event")
trans = tmat
db_long<- prepMSM(data=colonMSM, trans, timesNames, status)
res<-LR.test(data=db_long, times=180, from = 2, to = 3, replicas = 1000)
res$globalTestLR

times<-c(73.5, 117, 223, 392, 681)
res2<-LR.test(data=prothr, times=times, from = 2, to = 3, replicas = 1000)
res2$localTestLR
res2$globalTestLR

res3<-LR.test(data=prothr, times=times, from = 2, to = 1, replicas = 1000)
res3$localTestLR
res3$globalTestLR


[Package markovMSM version 0.1.3 Index]