Description Usage Arguments Value Examples
View source: R/CIVMR_function.R
This function produce a Constrained Instrumental Variable with cross-validation. Specifically, for a predefined fold the CIV is calculated using all samples except this fold, then the CIV solution is applied to the samples in this fold to obtain corresponding CIV. In this way the correlation between samples are expected to be reduced.
1 | cv_CIV(MR.data, n_folds = 10)
|
MR.data: |
a data frame containing G,X,Z,Y. |
n_folds: |
number of folds for cross-validation. |
weights: A matrix with dimension n_folds * p. Each row is a CIV solution c from a specific fold.
civ.IV: cross-validated CIV instrument G^{*}=Gc.
beta_est: causal effect estimation of X on Y using CIV instrument civ.IV
1 2 3 4 | data(simulation)
cv.civ <- cv_CIV(simulation)
#strong correlation between CIV solutions from different folds.
cor(t(cv.civ$weights))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.