Learn R Programming

ivbma (version 1.05)

ivbma: Instrumental Variable Bayesian Model Averaging via Conditional Bayes Factors

Description

This function estimates an Instrumental Variable (IV) system while incorporating model uncertainty and performing model averaging using an MC3-within-Gibbs Sampler.

Usage

ivbma(Y, X, Z, W, s = 1000, b = round(s/10), full = FALSE, 
    odens = min(c(5000, s - b)), print.every = round(s/10), run.diagnostics = FALSE)

Arguments

Y
n x 1 matrix. Response variable
X
n x r matrix. Endogenous variables
W
n x p matrix. Further explanatory variables. You are responsible for including an intercept.
Z
n x q matrix. Instrumental variables
s
integer. Number of iterations
b
integer. Number of iterations to discard as burn-in.
full
If full is TRUE then model selection is not performed
odens
Output density. How many samples from the posterior should be returned? Note that posterior expectations are taken over every sample after burn-in
print.every
After how many iterations should the progress be printed?
run.diagnostics
If TRUE, this will compute experimental diagnostics to assess the validity of the instruments in use. Note that this adds a non-negligible amount of computing time.

Value

  • rhoAn odens x (r + p) matrix with sampled values for the outcome stage. Endogenous variables come first.
  • rho.barPosterior expectation of the outcome stage taken over all iterations
  • lambdaA (p + q) x r x odens array with sampled values for the parameters of the first stage regressions. Instruments come first.
  • lambda.barPosterior expectation of each first stage taken over all iterations
  • Sigmaodens sampled realizations of Sigma
  • Sigma.barPosterior expectation of Sigma taken over all iterations
  • MSampled first stage models
  • M.barPosterior first stage inclusion probabilities
  • LSampled second stage models
  • L.barPosterior second stage inclusion probabilities
  • If run.diagnostics was set to TRUE then you also receive
  • SarganModel averaged Sargan p-values. Lower values indicate lack of instrument validity
  • Bayesian.SarganAn _Experimental_ Bayesian Sargan diagnostic based on Conditional Bayes Factors. Same direction as above

Details

The function estimates the parameters based on the model $$Y = [X W] * \rho + \epsilon$$ $$X = [Z W] * \lambda + \eta$$ with $$(\epsilon_i, \eta_i)^T \sim N_2 ( 0,\Sigma)$$ and its extension to multiple endogenous variables. If full is set to FALSE model uncertainty is included using conditional Bayes factors.

References

Anna Karl and Alex Lenkoski (2012). "Instrumental Variable Bayesian Model Averaging via Conditional Bayes Factors" http://arxiv.org/abs/1202.5846

See Also

summary.ivbma ivbma.cv.study

Examples

Run this code
set.seed(1)
data(growth)
attach(growth)
## To replicate KL, set s to 1e5
a <- ivbma(Y, X, Z, W, s = 1e2)
summary(a, nms.U = c(names(Z), names(W)),nms.V = c(names(X), names(W)))
detach(growth)

set.seed(1)
data(margarine)
attach(margarine)
## To replicate KL, set s to 2.5e5
a <- ivbma(Y, X, Z, W, s=1e2)
summary(a, nms.U = c(names(Z), names(W)),nms.V = c(names(X), names(W)))
detach(margarine)

Run the code above in your browser using DataLab