Description Usage Arguments Value Examples
View source: R/greedy_search.R
At each greedy step, we examine all of the IV models in the neighbor set in parallel. The neighbor with the highest model evidence is chosen and the algorithm moves to it if the evidence is higher compared to the current IV model.
1 2 3 4 5 6 7 8 9 10 11 12 | parallel_greedy_search(
J,
N,
SS,
sigma_G,
sd_slab = 1,
sd_spike = 0.01,
init_model = NULL,
get_neighbors = neighbor_IV_models,
LA_function = safe_Laplace_approximation,
...
)
|
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. |
init_model |
Character vector describing starting IV model in search. |
get_neighbors |
Function to get neighbor IV models at every step. |
LA_function |
Function for computing the IV model Laplace approximation |
... |
Extra arguments to pass to Laplace approximation function. |
A list containing the optimum found with greedy search, the list of IV models visited and their approximations, and the number of visited models.
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)
parallel_greedy_search(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.