iv.diagnosis: Diagnostics of instrumental variable analysis

Description Usage Arguments Value Functions Author(s) References Examples

View source: R/barplot.R

Description

Diagnostics of instrumental variable analysis

Usage

1
2
3
4
iv.diagnosis(Y, D, Z, X)

iv.diagnosis.plot(output, order.by = c("bias.amplify", "ols.bias",
  "2sls.bias"), bias.ratio = TRUE, base_size = 15, text_size = 5)

Arguments

Y

A numeric vector of outcomes.

D

A vector of endogenous variables.

Z

A vector of instruments.

X

A vector, matrix or data frame of (exogenous) covariates.

output

Output from iv.diagnosis.

order.by

Order the bars by bias amplifying factor (variance of the outcome explained by each covariate), bias of the OLS estimate, or bias of the 2SLS estimate.

bias.ratio

Add bias ratios (text) to the plot?

base_size

size of the axis labels

text_size

size of the text (bias ratios)

Value

a list or data frame

x.mean1

Mean of X under Z = 1 (reported if Z is binary)

x.mean0

Mean of X under Z = 0 (reported if Z is binary)

coef

OLS coefficient of X ~ Z (reported if Z is not binary)

se

Standard error of OLS coefficient (reported if Z is not binary)

p.val

p-value of the independence of Z and X (Fisher's test if both are binary, logistic regression if Z is binary, linear regression if Z is continuous)

x.sd

sample standard deviations of X

stand.diff

Standardized difference (reported if Z is binary)

bias.ratio

Bias ratio

bias.amplify

Amplification of bias ratio

bias.ols

Bias of OLS

bias.2sls

Bias of two stage least squares)

Functions

Author(s)

Qingyuan Zhao

References

Examples

1
2
3
4
5
6
7
8
n <- 10000
Z <- rbinom(n, 1, 0.5)
X <- data.frame(matrix(rbinom(n * 5, 1, 0.5), n))
D <- rbinom(n, 1, plogis(Z + X[, 1] + X[, 2] + X[, 3]))
Y <- D + X[, 1] + X[, 2] + rnorm(n)
output <- iv.diagnosis(Y, D, Z, X)
print(output)
iv.diagnosis.plot(output)

ivmodel documentation built on Nov. 17, 2017, 4:09 a.m.