# A short example of use of Addregmc: # , 2001-12-01 # 1) Install "addreg version 2" (beta) # 2) Use source("path/addregmc.R") to read # the source code for Addregmc # (where "path" is the path to the folder that contains the downloaded file) # Example of analysis as given in: # Odd Aalen, Ørnulf Borgan and Harald Fekjær (2001) # "Covariate adjustment of event histories estimated from Markov chains: The additive approach" # Biometric, vol. 57, 108-116 # Run Additive hazard regression on each transition: overg01 <- addreg(Surv(TPu,DP)~Z10+newZ1+newZ2+newZ1Z2,testobs=F,estcovar=T,data=bmtdata) overg12 <- addreg(Surv(TPu,T2u,D3)~low+high+Z8+newZ1+newZ2,testobs=F,estcovar=T,data=bmtdata[bmtdata$DP==1,]) overg02 <- addreg(Surv(t02,s02)~1,testobs=F,estcovar=T,data=bmtdata) # Define each transition: overg01.mce <- addregmce(overg01,from=1,to=2) overg12.mce <- addregmce(overg12,from=2,to=3) overg02.mce <- addregmce(overg02,from=1,to=3) # Choose covariates: covardata <- data.frame(Z10=1,low=0,high=1,Z8=0,newZ1=0,newZ2=0,newZ1Z2=0) # Run addregmc / estimate: addregmc.res <- addregmc(list(overg01.mce,overg12.mce,overg02.mce),covardata,estcovar=F) # Check the transitions: addregmc.res # Get estimates: summary(addregmc.res) summary(addregmc.res,esttime=12,confint=T) # Plot results: plot(addregmc.res) plot(addregmc.res,fromto=c(1,2),stoptime=55)