check.ETA {cvDSA} | R Documentation |
'check.ETA' is used to check the Experimental Treatment Assignment assumption for the IPTW/DR fitting of the MSM.
check.ETA(y, a, v, w, data=NULL, yfamily='gaussian', afamily='binomial', model.msm=NULL, model.aw=NULL, model.av=NULL, model.yaw=NULL, model.yyaw=NULL, wt.censor=NULL, ncv=5, ncv.nuisance=5, stable.wt=T, n.sim, index.v.inW)
y |
response variable: vector of length 'n'. |
a |
treatment variable: vector of length 'n'. |
v |
adjustment variable: vector/matrix. |
w |
baseline covariates: vector/matrix. |
data |
an optional data frame containing the variables in 'y', 'a', 'v' and 'w'. |
yfamily |
a description of the error distribution and link function to be used in the 'y'-related model E[Y|A,W]. Availible choices are 'gaussian' and 'binomial'. |
afamily |
a description of the error distribution and link function to be used in the 'a'-related models (g(A|W) and g(A|V)). Availible choices are 'gaussian' and 'binomial'. |
model.msm |
a list description of the MSM, e.g., model.msm=list(Model=, Size=, Order=, Int= ). |
model.aw |
a list description of g(A|W). See 'model.msm'. |
model.av |
a list description of g(A|V). See 'model.msm'. |
model.yaw |
a list description of Q(Y|A,W). See 'model.msm'. |
model.yyaw |
a list description of Q(Y^2|A,W). See 'model.msm'. |
wt.censor |
an optional vector of censoring weights to be used in the selecting/fitting process. |
ncv |
an integer of the number of fold for the V-fold cross-validation for selecting MSM. |
ncv.nuisance |
an integer of the number of fold for the V-fold cross-validation for selecting the nuisance parameter models, e.g., g(A|W), g(A|V), Q(Y|A,W) and Q(Y^2|A,W). |
stable.wt |
a logical value indicating whether stabilized weight should be used in 'IPTW' and 'DR' mapping/fitting. |
n.sim |
an integer indicating the number of boostrap iterations. |
index.v.inW |
an integer array indicating which column(s) in 'w' is(are) in 'v'. |
'check.ETA' returns the original fittings of the IPTW, Gcomp and DR estimators, the means and standard deviations of the bootstrap IPTW, Gcomp and DR coefficients, the estimated bias of IPTW estimator due to ETA violations, the adjusted IPTW estimator and all the bootstrap estimators.
cvMSM
, cvGLM
, cvDCY
, cv.predict
, create.obs.data
# Example 1. #Let W={W1, W2} n <- 1000 w1 <- runif(n, 0, 1); w2 <- runif(n, 0, 1); w <- cbind(w1=w1, w2=w2); # g(A|W) = logit^(-1) (1 - W1 + W2) model.aw <- list(formula=list(c(1,0),c(0,1)), coef=c(1,-1,1)); # E(Y|A,W) = 1 + 2A + 1.5W1 + W2 - W1*W2 model.yaw <- list(formula=list(c(1,0,0),c(0,1,0),c(0,0,1), c(0,1,1)), coef=c(1, 2, 1.5, 1, -1)); obs.data <- create.obs.data(w, afamily='binomial', yfamily='gaussian', model.yaw, model.aw) obs.data.ETA <- check.ETA(y=y, a=a, v=w1, w=cbind(w1,w2), data=obs.data, yfamily='gaussian', afamily='binomial', model.msm=list(Model="a+w1"), model.aw=list(Model="w1+w2"), model.av=list(Model="w1"), model.yaw=list(Model="a+w1+w2+w1^2"), stable.wt=F, n.sim=100, index.v.inW=c(1)) # Example 2. n<-2000; w1<-runif(n); w2<-runif(n); w3<-runif(n); w4<-runif(n); w<-cbind(w1,w2,w3,w4); # Let g(A|W) = logit^(-1) (-1 + w1 - w2 + w1*w3) model.aw <- list(formula = "w1+w2+w1:w3", coef = c(-1, 1, -5, 1)) # about 60 # Let E(Y|A, W)=-1+A+w1+w2+w1*w3; model.yaw <- list(formula="a+w1+w2+w1:w3", coef=c(-1, 1, 1, 1, 1)); obs.data <- create.obs.data(w, afamily='binomial', yfamily='gaussian', model.yaw, model.aw) obs.data.ETA <- check.ETA(y=y, a=a, v=w1, w=w, data=obs.data, yfamily='gaussian', afamily='binomial', model.msm=list(Model="a+w1"), model.aw=list(Model=model.aw$formula), model.av=list(Model="w1"), model.yaw=list(Model=model.yaw$formula), model.yyaw=NULL, stable.wt=F, n.sim=100, index.v.inW=c(1)) # Example 3. n<-2000; w1<-runif(n); w2<-runif(n); w3<-runif(n); w4<-runif(n); w<-cbind(w1,w2,w3,w4); # Let g(A|W) = logit^(-1) (-1 + w1 - w2 + w1*w3) model.aw <- list(formula = "w1+w2+w1:w3", coef = c(-1, 1, -1, 1)) # No ETA violations # Let E(Y|A, W)=-1+A+w1+w2+w1^2; model.yaw <- list(formula="a+w1+w2+w1^2", coef=c(-1, 1, 1, 1, 1)); obs.data <- create.obs.data(w, afamily='binomial', yfamily='gaussian', model.yaw, model.aw) obs.data.ETA <- check.ETA(y=y, a=a, v=w1, w=w, data=obs.data, yfamily='gaussian', afamily='binomial', model.msm=list(Model=NULL, Size=5, Order=c(1,2), Int=2), model.aw=list(Model=model.aw$formula), model.av=list(Model="w1"), model.yaw=list(Model=model.yaw$formula), model.yyaw=list(Size=6, Order=c(1,2,2,2,1), Int=2), ncv=5, ncv.nuisance=2, stable.wt=F, n.sim=10, index.v.inW=c(1))