sisVIVE: Some Invalid Some Valid Instrumental Variables Estimator

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

View source: R/sisVIVE.R

Description

Selects invalid instruments from a candidate of instruments and estimates the causal effect of exposure on outcome

Usage

1
sisVIVE(Y, D, Z, intercept = TRUE, normalize = TRUE)

Arguments

Y

A numeric vector of outcomes

D

A numeric vector of exposures

Z

A numeric matrix of instruments, with each column referring to one instrument

intercept

A logical declaring whether the intercept be included. Default is TRUE

normalize

A logical declaring whether the columns of Z should be scaled with variance 1. Default is TRUE

Details

Given a candidate of instruments, the algorithm selects invalid instruments and estimates the causal effect of exposure on outcome by leveraging LARS. The entire solution path, which includes the estimate of the causal effect as well as the estimated set of invalid instruments, is computed for lambda.

Value

A "sisVIVE" object is returned, for which print, plot, summary, and predict methods exist.

alpha

Estimates of alpha, the causal effect of the instrument on the outcome. Each row represents a lambda value and each column corresponds to the estimate of alpha corresponding to that same column in Z

beta

Estimate of beta, the causal effect of the exposure on the outcome. Each entry represents an estimate of beta for a lambda value

whichInvalid

Estimate of which instruments are invalid. Each entry refers to the column indexes of the Z matrix which were deemed to be invalid for a lambda value

lambda

Lambda used in the algorithm

larsObject

A LARS object

Y

A numeric vector of outcomes

D

A numeric vector of exposures

Z

A numeric matrix of instruments, with each column referring to one instrument

Dhat

A numeric vector of predicted exposure given instruments

Author(s)

Hyunseung Kang. We thank Frank Windmeijer for his suggestion to improve the code.

References

For LARS: Efron, Hastie, Johnstone and Tibshirani (2003) "Least Angle Regression" (with discussion) Annals of Statistics

See Also

summary and predict methods for sisVIVE, and cv.sisVIVE which performs cross-validation to choose the tuning parameter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(MASS)
library(lars)

n = 1000; L = 10; s= 3;
Z <- matrix(rnorm(n*L),n,L)
error <- mvrnorm(n,rep(0,2),matrix(c(1,0.8,0.8,1),2,2))
intD = rnorm(1); ZtoD =   rnorm(L,0,1); ZtoY = c(rnorm(s),rep(0,L-s)); DtoY = 1; intY = rnorm(1)
D = intD + Z %*% ZtoD + error[,1]
Y = intY + Z %*% ZtoY + D * DtoY + error[,2]

result = sisVIVE(Y,D,Z)
summary(result)

Example output

Loading required package: lars
Loaded lars 1.2


Call:
sisVIVE(Y = Y, D = D, Z = Z)
 Estimates of Beta    Number of Invalid IVs        Invalid IVs
         0.9554367                        0                   
         0.9990268                        1                  2
         1.0344044                        2                2,3
         1.0086483                        3              1,2,3
         1.0085856                        4            1,2,3,5
         1.0081106                        5          1,2,3,4,5
         1.0083853                        6        1,2,3,4,5,7
         1.0063534                        7      1,2,3,4,5,7,8
         1.0054089                        8   1,2,3,4,5,7,8,10
         1.0061529                        9 1,2,3,4,5,7,8,9,10
         1.0280706                        9 1,2,3,4,5,6,7,9,10
         1.0280706                        9 1,2,3,4,5,6,7,9,10
         1.0451771                        9 1,2,3,4,6,7,8,9,10
         1.0451771                        9 1,2,3,4,6,7,8,9,10

sisVIVE documentation built on May 2, 2019, 1:44 p.m.

Related to sisVIVE in sisVIVE...