Description Usage Arguments Value Examples
Routine to find the most likely causal models using a simple Metropolis- Hastings IV model stochastic search
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | find_causal_models(
J,
N,
SS,
sigma_G,
sd_slab = 1,
sd_spike = 0.01,
max_iter = 1000,
propose_model = propose_neighbor_IV_model,
LA_function = safe_Laplace_approximation,
greedy_start = NULL,
keep_greedy_approximations = FALSE,
...
)
|
J |
Integer number of candidate instruments. |
N |
Integer number of observations. |
SS |
Numeric matrix containing first- and second-order statistics. |
sigma_G |
Numeric vector of genetic IV standard deviations. |
sd_slab |
Numeric scale parameter of slab component. |
sd_spike |
Numeric scale parameter of spike component. |
max_iter |
Integer defining maximum number of MCMC iterations. |
propose_model |
Proposal function indicating new IV model candidates. |
LA_function |
Function for computing the IV model Laplace approximation. |
greedy_start |
List returned by greedy search to be used as starting point. |
keep_greedy_approximations |
Logical flag asking if greedy search history should be stored and used in the new MCMC search. |
... |
Extra arguments to pass to Laplace_approximation function. |
A list containing the list of models explored and their approximations, the number of models explored, the total number of MCMC iterations, as well as the acceptance rate.
1 2 3 4 5 6 | J <- 5 # number of instruments
N <- 1000 # number of samples
parameters <- random_Gaussian_parameters(J)
EAF <- runif(J, 0.1, 0.9) # EAF random values
dat <- generate_data_MASSIVE_model(N, 2, EAF, parameters)
find_causal_models(J, N, dat$SS, binomial_sigma_G(dat$SS), 1, 0.01)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.