em_illness_death_phmm_weight {semicmprskcoxmsm} | R Documentation |
Using EM Type Algorithm for MSM Illness-death General Markov Model
Description
Under the general Markov illness-death model, with normal frailty term which is a latent variable. We use the EM type algorithm to estimate the coefficient in the MSM illness-death general Markov model.
Usage
em_illness_death_phmm_weight(data,X1,X2,event1,event2,w,Trt,
EM_initial,sigma_2_0)
Arguments
data |
The dataset, includes non-terminal events, terminal events as well as event indicator. |
X1 |
Time to non-terminal event, could be censored by terminal event or lost to follow up. |
X2 |
Time to terminal event, could be censored by lost to follow up. |
event1 |
Event indicator for non-terminal event. |
event2 |
Event indicator for terminal event. |
w |
IP weights. |
Trt |
Treatment variable. |
EM_initial |
Initial value for the EM algorithm, the output of |
sigma_2_0 |
Initial value for |
Details
Similar as the usual Markov model. We postulate the semi-parametric Cox models with a frailty term for three transition rates in marginal structural illness-death model:
\lambda_{1}(t_1 ; a) = \lambda_{01}(t)e^{\beta_1 a + b}, t_1 > 0 ;
\lambda_{2}(t_2 ; a) = \lambda_{02}(t)e^{\beta_2 a + b}, t_2 > 0 ;
and
\lambda_{12}(t_2 \mid t_1 ; a) = \lambda_{03}(t_2)e^{\beta_3 a + b}, 0 < t_1 < t_2 ,
where b \sim N(0,1)
. Since b is not observed in the data, we use the IP weighted EM type algorithm to estimate all the parameters in the MSM illness-death general Markov model.
Value
beta1 |
The EM sequence for estimating |
beta2 |
The EM sequence for estimating |
beta3 |
The EM sequence for estimating |
Lambda01 |
List of two dataframes for estimated |
Lambda02 |
List of two dataframes for estimated |
Lambda03 |
List of two dataframes for estimated |
sigma_2 |
The EM sequence for estimating |
loglik |
The EM sequence for log-likelihood at each iteration. |
em.n |
Number of EM steps to converge. |
data |
Data after running the EM. |
Examples
n <- 500
set.seed(1234)
Cens = runif(n,0.7,0.9)
set.seed(1234)
OUT1 <- sim_cox_msm_semicmrsk(beta1 = 1,beta2 = 1,beta3 = 0.5,
sigma_2 = 1,
alpha0 = 0.5, alpha1 = 0.1, alpha2 = -0.1, alpha3 = -0.2,
n=n, Cens = Cens)
data_test <- OUT1$data0
## Get the PS weights
vars <- c("Z1","Z2","Z3")
ps1 <- doPS(data = data_test,
Trt = "A",
Trt.name = 1,
VARS. = vars,
logistic = TRUE,w=NULL)
w <- ps1$Data$ipw_ate_stab
### Fit the General Markov model
EM_initial <- OUT_em_weights(data = data_test,
X1 = "X1",
X2 = "X2",
event1 = "delta1",
event2 = "delta2",
w = w,
Trt = "A")
res1 <- em_illness_death_phmm_weight(data = data_test,
X1 = "X1",
X2 = "X2",
event1 = "delta1",
event2 = "delta2",
w = w,
Trt = "A",
EM_initial = EM_initial,
sigma_2_0 = 2)
print(paste("The estimated value for beta1 is:", round(res1$beta1[res1$em.n],5) ) )