View source: R/SearchingSampling.R
SearchingSampling | R Documentation |
Construct Searching and Sampling confidence intervals for the causal effect, which provides the robust inference of the treatment effect in the presence of invalid instrumental variables in both low-dimensional and high-dimensional settings. It is robust to the mistakes in separating valid and invalid instruments.
SearchingSampling( Y, D, Z, X = NULL, intercept = TRUE, method = c("OLS", "DeLasso", "Fast.DeLasso"), robust = TRUE, Sampling = TRUE, alpha = 0.05, CI.init = NULL, a = 0.6, rho = NULL, M = 1000, prop = 0.1, filtering = TRUE, tuning.1st = NULL, tuning.2nd = NULL )
Y |
The outcome observation, a vector of length n. |
D |
The treatment observation, a vector of length n. |
Z |
The instrument observation of dimension n \times p_z. |
X |
The covariates observation of dimension n \times p_x. |
intercept |
Whether the intercept is included. (default = |
method |
The method used to estimate the reduced form parameters. |
robust |
If |
Sampling |
If |
alpha |
The significance level (default= |
CI.init |
An initial range for beta. If |
a |
The grid size for constructing beta grids. (default= |
rho |
The shrinkage parameter for the sampling method. (default= |
M |
The resampling size for the sampling method. (default = |
prop |
The proportion of non-empty intervals used for the sampling method. (default= |
filtering |
Filtering the resampled data or not. (default= |
tuning.1st |
The tuning parameter used in the 1st stage to select relevant instruments. If |
tuning.2nd |
The tuning parameter used in the 2nd stage to select valid instruments. If |
When robust = TRUE
, the method
will be input as ’OLS’
. For rho
, M
, prop
, and filtering
, they are required only for Sampling = TRUE
.
As for tuning parameter in the 1st stage and 2nd stage, if do not specify, for method "OLS" we adopt √{\log n} for both tuning parameters, and for other methods
we adopt \max{(√{2.01 \log p_z}, √{\log n})} for both tuning parameters.
SearchingSampling
returns an object of class "SS", which is a list containing the following components:
ci |
1-alpha confidence interval for beta. |
SHat |
The set of selected relevant IVs. |
VHat |
The initial set of selected relevant and valid IVs. |
check |
The indicator that the plurality rule is satisfied. |
Guo, Z. (2021), Causal Inference with Invalid Instruments: Post-selection Problems and A Solution Using Searching and Sampling, Preprint arXiv:2104.06911.
data("lineardata") Y <- lineardata[,"Y"] D <- lineardata[,"D"] Z <- as.matrix(lineardata[,c("Z.1","Z.2","Z.3","Z.4","Z.5","Z.6","Z.7","Z.8")]) X <- as.matrix(lineardata[,c("age","sex")]) Searching.model <- SearchingSampling(Y,D,Z,X, Sampling = FALSE) summary(Searching.model) Sampling.model <- SearchingSampling(Y,D,Z,X) summary(Sampling.model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.