MASSIVE: MASSIVE algorithm (Model Assessment and Stochastic Search for...

Description Usage Arguments Value Examples

View source: R/MASSIVE.R

Description

MASSIVE algorithm (Model Assessment and Stochastic Search for Instrumental Variable Estimation)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
MASSIVE(
  J,
  N,
  SS,
  sigma_G,
  sd_slab,
  sd_spike,
  max_iter = 1000,
  greedy_search = parallel_greedy_search,
  Laplace_approximation = safe_Laplace_approximation,
  pruning_threshold = 0.003,
  posterior_samples = 10000,
  ...
)

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 instrument standard deviations.

sd_slab

Numeric scale parameter of slab component.

sd_spike

Numeric scale parameter of spike component.

max_iter

Maximum number of stochastic search steps.

greedy_search

Function for initial greedy search.

Laplace_approximation

Function used to compute Laplace approximation of IV model.

pruning_threshold

Numeric threshold for pruning approximated IV models. Models with probability less that threshold are pruned out.

posterior_samples

Integer number of posterior samples to generate.

...

Extra arguments for greedy_search, Laplace_approximations and find_causal_models.

Value

List of explored IV model approximations and their evidences

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(2020)
J <- 10
N <- 10000
G <- matrix(rbinom(N * J, 2, 0.3), N, J)
U <- rnorm(N)
X <- G %*% runif(J, 0.3, 0.5) + U + rnorm(N)
Y <- G[, 1:5] %*% runif(5, 0.1, 0.3) + X + U + rnorm(N)

Z <- cbind(1, G, X, Y)
SS <- t(Z) %*% Z / N
sigma_G <- apply(G, 2, sd)

samples <- MASSIVE::MASSIVE(J, N, SS, sigma_G, sd_slab = 1, sd_spike = 0.01, max_iter = 1000)
plot(density(samples$betas))
median(samples$betas)

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