cate: The main function for confounder adjusted testing

Description Usage Arguments Details Value Functions References See Also Examples

View source: R/cate.R

Description

The main function for confounder adjusted testing

Usage

 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
)

Arguments

formula

a formula indicating the known covariates including both primary variables and nuisance variables, which are seperated by |. The variables before | are primary variables and the variables after | are nuisance variables. It's OK if there is no nuisance variables, then | is not needed and formula becomes a typical formula with all the covariates considered primary. When there is confusion about where the intercept should be put, cate will include it in X.nuis.

X.data

the data frame used for formula

Y

outcome, n*p matrix

r

number of latent factors, can be estimated using the function est.confounder.num

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

Details

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.

Value

a list of objects

alpha

estimated alpha, r*d1 matrix

alpha.p.value

asymptotic p-value for the global chi squared test of alpha, a vector of length d1

beta

estimated beta, p*d1 matrix

beta.cov.row

estimated row covariance of beta, a length p vector

beta.cov.col

estimated column covariance of beta, a d1*d1 matrix

beta.t

asymptotic z statistics for beta

beta.p.value

asymptotic p-values for beta, based on beta.t

Y.tilde

the transformed outcome matrix, an n*p matrix

Gamma

estimated factor loadings, p*r matrix

Z

estimated latent factors

Sigma

estimated noise variance matrix, a length p vector

Functions

References

J. Wang, Q. Zhao, T. Hastie, and A. B. Owen (2017). Confounder adjustment in multiple testing. Annals of Statistics, 45(5), 1863–1894.

See Also

wrapper for wrapper functions of some existing methods.

Examples

 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)

cate documentation built on July 2, 2020, 4:08 a.m.