find_causal_models: Routine to find the most likely causal models using a simple...

Description Usage Arguments Value Examples

View source: R/MC3_sampler.R

Description

Routine to find the most likely causal models using a simple Metropolis- Hastings IV model stochastic search

Usage

 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,
  ...
)

Arguments

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.

Value

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.

Examples

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)

igbucur/MASSIVE documentation built on Oct. 26, 2020, 1:26 a.m.