ivbma: Instrumental Variable Bayesian Model Averaging via...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ivbma.R

Description

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

Usage

1
2
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.

Details

The function estimates the parameters based on the model

Y = [X W] * ρ + ε

X = [Z W] * λ + η

with

(ε_i, η_i)^T \sim N_2 ( 0,Σ)

and its extension to multiple endogenous variables. If full is set to FALSE model uncertainty is included using conditional Bayes factors.

Value

rho

An odens x (r + p) matrix with sampled values for the outcome stage. Endogenous variables come first.

rho.bar

Posterior expectation of the outcome stage taken over all iterations

lambda

A (p + q) x r x odens array with sampled values for the parameters of the first stage regressions. Instruments come first.

lambda.bar

Posterior expectation of each first stage taken over all iterations

Sigma

odens sampled realizations of Sigma

Sigma.bar

Posterior expectation of Sigma taken over all iterations

M

Sampled first stage models

M.bar

Posterior first stage inclusion probabilities

L

Sampled second stage models

L.bar

Posterior second stage inclusion probabilities

If run.diagnostics was set to TRUE then you also receive

Sargan

Model averaged Sargan p-values. Lower values indicate lack of instrument validity

Bayesian.Sargan

An _Experimental_ Bayesian Sargan diagnostic based on Conditional Bayes Factors. Same direction as above

Author(s)

Alex Lenkoski (alex.lenkoski@uni-heidelberg.de)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

ivbma documentation built on May 29, 2017, 12:31 p.m.

Related to ivbma in ivbma...