Print method for an object of class 'msdata'

# S3 method for msdata
print(x, trans = FALSE, ...)

Arguments

x

Object of class 'msdata', as prepared for instance by msprep

trans

Boolean specifying whether or not the transition matrix should be printed as well; default is FALSE

...

Further arguments to print

Value

No return value

See also

Author

Hein Putter H.Putter@lumc.nl

Examples

# transition matrix for illness-death model tmat <- trans.illdeath() # some data in wide format tg <- data.frame(stt=rep(0,6),sts=rep(0,6), illt=c(1,1,6,6,8,9),ills=c(1,0,1,1,0,1), dt=c(5,1,9,7,8,12),ds=c(1,1,1,1,1,1), x1=c(1,1,1,2,2,2),x2=c(6:1)) tg$x1 <- factor(tg$x1,labels=c("male","female")) tg$patid <- factor(2:7,levels=1:8,labels=as.character(1:8)) # define time, status and covariates also as matrices tt <- matrix(c(rep(NA,6),tg$illt,tg$dt),6,3) st <- matrix(c(rep(NA,6),tg$ills,tg$ds),6,3) keepmat <- data.frame(gender=tg$x1,age=tg$x2) # data in long format using msprep msp <- msprep(time=tt,status=st,trans=tmat,keep=as.matrix(keepmat)) print(msp)
#> An object of class 'msdata' #> #> Data: #> id from to trans Tstart Tstop time status keep1 keep2 #> 1 1 1 2 1 0 1 1 1 male 6 #> 2 1 1 3 2 0 1 1 0 male 6 #> 3 1 2 3 3 1 5 4 1 male 6 #> 4 2 1 2 1 0 1 1 0 male 5 #> 5 2 1 3 2 0 1 1 1 male 5 #> 6 3 1 2 1 0 6 6 1 male 4 #> 7 3 1 3 2 0 6 6 0 male 4 #> 8 3 2 3 3 6 9 3 1 male 4 #> 9 4 1 2 1 0 6 6 1 female 3 #> 10 4 1 3 2 0 6 6 0 female 3 #> 11 4 2 3 3 6 7 1 1 female 3 #> 12 5 1 2 1 0 8 8 0 female 2 #> 13 5 1 3 2 0 8 8 1 female 2 #> 14 6 1 2 1 0 9 9 1 female 1 #> 15 6 1 3 2 0 9 9 0 female 1 #> 16 6 2 3 3 9 12 3 1 female 1
print(msp, trans=TRUE)
#> An object of class 'msdata' #> #> Data: #> id from to trans Tstart Tstop time status keep1 keep2 #> 1 1 1 2 1 0 1 1 1 male 6 #> 2 1 1 3 2 0 1 1 0 male 6 #> 3 1 2 3 3 1 5 4 1 male 6 #> 4 2 1 2 1 0 1 1 0 male 5 #> 5 2 1 3 2 0 1 1 1 male 5 #> 6 3 1 2 1 0 6 6 1 male 4 #> 7 3 1 3 2 0 6 6 0 male 4 #> 8 3 2 3 3 6 9 3 1 male 4 #> 9 4 1 2 1 0 6 6 1 female 3 #> 10 4 1 3 2 0 6 6 0 female 3 #> 11 4 2 3 3 6 7 1 1 female 3 #> 12 5 1 2 1 0 8 8 0 female 2 #> 13 5 1 3 2 0 8 8 1 female 2 #> 14 6 1 2 1 0 9 9 1 female 1 #> 15 6 1 3 2 0 9 9 0 female 1 #> 16 6 2 3 3 9 12 3 1 female 1 #> #> Transition matrix: #> to #> from healthy illness death #> healthy NA 1 2 #> illness NA NA 3 #> death NA NA NA