Description Usage Arguments Value Author(s) Examples
Generating classification weights and treatment labels using the AIPW method
1 | ITR_AIPW(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 |
muT.reg |
Estimated survival outcome |
muC.reg |
Estimated cumulative cost outcome |
lambda |
Willingness-to-pay parameter |
delta.Y, delta.ST, delta.CC, ITR_aipwCE, ITR_aipwST
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_aipwCE |
Treatment label based on NMB outcomes |
ITR_aipwST |
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 67 | 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 AIPW estimates -------###
ITR.aipw=ITR_AIPW(ST = FT, CC = CC, A = A, est_ps=est_ps, cen = event, est_cen = cen.w,lambda = lambda,
muT.reg = muT.reg.exp, muC.reg = muC.reg.norm)
aipw.Y=ITR.aipw$delta.Y
aipw.ITRCE=ITR.aipw$ITR_aipwCE
# AIPW contrasts based on CE
fit.aipw=rpart(aipw.ITRCE ~ x1+x2+x3, weights=aipw.Y, method="class",
control = rpart.control(minsplit = 10, cp = 0.01,xval = 10))
g.aipw=as.numeric(predict(fit.aipw, type="class"))-1;table(g.aipw)
imp.g.aipw = fit.aipw$variable.importance;imp.g.aipw
## 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.