View source: R/causal.null.test.R
causalNullTest | R Documentation |
This function performs a hypothesis test that the causal dose-response curve theta(a) is flat on the support of the observed exposure A. The exposure may be discrete, continuous, or an arbitrary mixture of discrete and continuous components. See the accompanying paper Westling (2020) for details.
causalNullTest(Y, A, W, p = 2, control = list())
Y |
|
A |
|
W |
|
p |
vector of exponents to use in the norm of Omega. Defaults to 2. |
control |
Optional list of control parameters. See |
causalNullTest
returns a named list with the following elements:
test |
A data.frame containing columns p (the exponent in the Lp norm used in the test), obs.stat (the observed Lp norm of the primitive Omega), p.val (the p-value corresponding to the test), ci.ll (the lower confidence limit corresponding to the Lp norm of the primitive), and ci.ul (the upper confidence limit corresponding to the Lp norm of the primitive). |
control |
Controls used in fitting. |
If If control$return.Omega == TRUE
, the following elements are also included in the output:
list(Omega.hat = data.frame(a=a.vals, Omega.hat), IF.vals = IF.vals, paths = paths))
Omega.hat |
A data.frame with values of a and the corresponding estimated function Omega.hat(a). |
IF.vals |
|
paths |
|
If save.nuis.fits = TRUE
, then the following elements are also included in the output:
mu.hat |
The estimated outcome regression function, as a list of fits if |
g.hat |
The estimated propensity, possibly as a list of fits if |
# Sample data n <- 1000 W <- data.frame(W1 = runif(n)) Z <- rbinom(n, size = 1, prob = 1/(1 + exp(2-W$W1))) A <- (1-Z) * rnorm(n, mean = W$W1, sd = abs(1 + W$W1)) Y <- rexp(n, rate = 1+abs(W$W1 * A)) causalNullTest(Y, A, W, p = c(1,2,Inf), control = list(cross.fit = FALSE, verbose=TRUE, g.n.bins = 2:5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.