Description Usage Arguments Details Value Functions References See Also Examples
The main function for confounder adjusted testing
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 | cate(
formula,
X.data = NULL,
Y,
r,
fa.method = c("ml", "pc", "esa"),
adj.method = c("rr", "nc", "lqs", "naive"),
psi = psi.huber,
nc = NULL,
nc.var.correction = TRUE,
calibrate = TRUE
)
cate.fit(
X.primary,
X.nuis = NULL,
Y,
r,
fa.method = c("ml", "pc", "esa"),
adj.method = c("rr", "nc", "lqs", "naive"),
psi = psi.huber,
nc = NULL,
nc.var.correction = TRUE,
calibrate = TRUE
)
|
formula |
a formula indicating the known covariates including both primary variables and nuisance variables, which are seperated by |
X.data |
the data frame used for |
Y |
outcome, n*p matrix |
r |
number of latent factors, can be estimated using the function |
fa.method |
factor analysis method |
adj.method |
adjustment method |
psi |
derivative of the loss function in robust regression |
nc |
position of the negative controls, if d0 > 1, this should be a matrix with 2 columns |
nc.var.correction |
correct asymptotic variance based on our formula |
calibrate |
if TRUE, use the Median and the Mean Absolute Deviation(MAD) to calibrate the test statistics |
X.primary |
primary variables, n*d0 matrix or data frame |
X.nuis |
nuisance covarites, n*d1 matrix |
Ideally nc
can either be a vector of numbers between 1 and p, if d0 = 1 or the negative controls are the same for every treatment variable, or a 2-column matrix specifying which positions of beta are known to be zero. But this is yet implemented.
a list of objects
estimated alpha, r*d1 matrix
asymptotic p-value for the global chi squared test of alpha, a vector of length d1
estimated beta, p*d1 matrix
estimated row covariance of beta
, a length p vector
estimated column covariance of beta
, a d1*d1 matrix
asymptotic z statistics for beta
asymptotic p-values for beta, based on beta.t
the transformed outcome matrix, an n*p matrix
estimated factor loadings, p*r matrix
estimated latent factors
estimated noise variance matrix, a length p vector
cate.fit
: Basic computing function called by cate
J. Wang, Q. Zhao, T. Hastie, and A. B. Owen (2017). Confounder adjustment in multiple testing. Annals of Statistics, 45(5), 1863–1894.
wrapper
for wrapper functions of some existing methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## simulate a dataset with 100 observations, 1000 variables and 5 confounders
data <- gen.sim.data(n = 100, p = 1000, r = 5)
X.data <- data.frame(X1 = data$X1)
## linear regression without any adjustment
output.naive <- cate(~ X1 | 1, X.data, Y = data$Y, r = 0, adj.method = "naive")
## confounder adjusted linear regression
output <- cate(~ X1 | 1, X.data, Y = data$Y, r = 5)
## plot the histograms of unadjusted and adjusted regression statistics
par(mfrow = c(1, 2))
hist(output.naive$beta.t)
hist(output$beta.t)
## simulate a dataset with 100 observations, 1000 variables and 5 confounders
data <- gen.sim.data(n = 100, p = 1000, r = 5)
## linear regression without any adjustment
output.naive <- cate.fit(X.primary = data$X1, X.nuis = NULL, Y = data$Y,
r = 0, adj.method = "naive")
## confounder adjusted linear regression
output <- cate.fit(X.primary = data$X1, X.nuis = NULL, Y = data$Y, r = 5)
## plot the histograms of unadjusted and adjusted regression statistics
par(mfrow = c(1, 2))
hist(output.naive$beta.t)
hist(output$beta.t)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.