create.obs.data {cvDSA} | R Documentation |
'create.obs.data' generates a simulation data frame based on the given nuisance parameter models.
create.obs.data(w, afamily='binomial', yfamily='gaussian', model.yaw, model.aw)
w |
baseline covariates: vector/matrix. |
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.aw |
a list description of g(A|W). See 'Examples'. |
model.yaw |
a list description of E(Y|A,W). See 'Examples'. |
'create.obs.data' returns a dataset with the baseline covariates 'w' (given by user), observed treatment variable 'a' and the corresponding outcome 'y'.
For continuous variable 'a' or 'y', we use error ~ N(0,1) as the standard deviation.
cvMSM
, cvGLM
, cvDCY
, cv.predict
, check.ETA
#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) # Or model.aw <- list(formula="w1+w2", coef=c(1,-1,1)); model.yaw <- list(formula="a+w1+w2+w1:w2",coef=c(1, 2, 1.5, 1, -1)); obs.data <- create.obs.data(w, afamily='binomial', yfamily='gaussian', model.yaw, model.aw)