OUT_em_weights: Initial Value For Fitting the General Markov Model

View source: R/general_markov_model.R

OUT_em_weightsR Documentation

Initial Value For Fitting the General Markov Model

Description

Compute the initial value for fitting the MSM illness-death general Markov model using EM type algorithm

Usage

OUT_em_weights(data,X1,X2,event1,event2,w,Trt)

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.

Details

See usual_illness_death_weight

Value

A list of vectors and dataframes:

beta1

Initial value for β_1, the coefficient for the non-terminal event model.

beta2

Initial value for β_2, the coefficient for the terminal event without non-terminal event model.

beta3

Initial value for β_3, the coefficient for the terminal event following non-terminal event model.

lambda1

Initial value for λ_{01} , the estimated baseline hazard for the non-terminal event model.

lambda2

Initial value for λ_{02} , the estimated baseline hazard for the terminal event without non-terminal event model.

lambda3

Initial value for λ_{03} , the estimated baseline hazard for the terminal event following non-terminal event model.

Lambda1

Initial value for Λ_{01} , the estimated cumulative baseline hazard for the non-terminal event model.

Lambda2

Initial value for Λ_{02} , the estimated cumulative baseline hazard for the terminal event without non-terminal event model.

Lambda3

Initial value for Λ_{03} , the estimated cumulative baseline hazard for the terminal event following non-terminal event model.

event1

An object of class Surv for non-terminal event.

event2

An object of class Surv for terminal event without non-terminal event.

event3

An object of class Surv for terminal event following non-terminal event.

See Also

usual_illness_death_weight

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

### Get the initial value
EM_initial <- OUT_em_weights(data = data_test,
                             X1 = "X1",
                             X2 = "X2",
                             event1 = "delta1",
                             event2 = "delta2",
                             w = w,
                             Trt = "A")

semicmprskcoxmsm documentation built on April 30, 2022, 1:08 a.m.