Description Usage Arguments Value Author(s) Examples
Generating classification weights and treatment labels using the IPW method
1  | ITR_IPW(x)
 | 
CC | 
 Cumulative cost outcome  | 
ST | 
 Survival time outcome  | 
A | 
 Treatment variable  | 
est_ps | 
 Estimated propensity score  | 
cen | 
 censoring indicator  | 
est_cen | 
 Estimated censoring weight  | 
lambda | 
 Willingness-to-pay parameter  | 
delta.Y | 
 incremental net monetary benefit (NMB)  | 
delta.ST | 
 individual-level treatment effect on restricted survival times  | 
delta.ST | 
 individual-level treatment effect on cumulative cost  | 
ITR_ipwCE | 
 Treatment label based on NMB outcomes  | 
ITR_ipwST | 
 Treatment label based on restricted survival times  | 
Yizhe Xu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66  | library(ITRinCEA); library(survival);library(rpart)
#------------------- Simulate covariates, treatment, and 2 outcomes -----------------#
N=100
set.seed(99)
x1 = rnorm(N,0,1)
x2 = rnorm(N,0.5,1)
x3 = rnorm(N,0,1)
u0 = 0.1*x1
p0 = 1/(1+exp(-u0))
A = rbinom(N,1,p0)
# survival time (ST)
Main = as.matrix(data.frame(x1,x2,x3,A))
betaF=c(0.1,0.3,0.3,0.4); gammaF=0.3
ST = exp(Main
RST = pmin(ST,rep(3,N))       # restriction time point = 3 year
C=runif(N,0,10)
FT = pmin(RST,C);summary(FT)
cen = ifelse(RST<=C,1,0)      # censoring indicator
event = as.numeric(I(cen==1));table(event)
# Cumulative cost (CC)
gammaC=0.1
beta = 100*exp(Main
YC = rgamma(N,shape=200,scale=beta);summary(YC)
CC = YC*FT;summary(CC)
# CE outcome
lambda=50000
Y = lambda*FT-CC;summary(Y)
##-------------------- Analysis -------------------------##
#library(R.utils);library(survival);library(rpart)
#sourceDirectory("C:/Users/cryst/Box Sync/A_Crystal's Thesis/1 - Optimization-Classification/2 - Simulations & implementation/Simulation Codes and Results/1-CEanalysisITRcode/CE_ITR_SourceCode")
dat = data.frame(x1,x2,x3,A,FT,event,cen,CC,Y)
muT.reg.exp = Reg.mu.exp(ST=FT, A=A, Xs=as.matrix(data.frame(x1,x3)), Ms=x2, data=dat)
muC.reg.norm = Reg.mu.norm(CC=CC, A=A, Xs=as.matrix(data.frame(x1,x3)), Ms=x2, data=dat)
# estimated CE outcome
muY.reg.norm = lambda*muT.reg.exp-muC.reg.norm
# estimated PS
est_ps = EstPS(A=A,Xs=cbind(x1,x3))
# create censoring weight
cen.wm = glm(event ~ A, family = "binomial");cen.w = predict(cen.wm, type = "response")
###------- calculate IPW estimates -------###
ITR.ipw=ITR_IPW(ST = FT, CC = CC, A = A, est_ps=est_ps, cen = event, est_cen = cen.w,lambda = lambda)
ipw.Y=ITR.ipw$delta.Y                     ## individual treatment effect on CE
ipw.ITRCE=ITR.ipw$ITR_ipwCE               ## estimated regime based on CE
# IPW contrasts based on CE
fit.ipw=rpart(ipw.ITRCE ~ x1+x2+x3, weights=ipw.Y, method="class",
              control = rpart.control(minsplit = 10, cp = 0.01,xval = 10))
g.ipw=as.numeric(predict(fit.ipw, type="class"))-1;table(g.ipw)
imp.g.ipw = fit.ipw$variable.importance;imp.g.ipw
## The function is currently defined as
function (x)
{
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.