https://github.com/beniaminogreen/cragg

Test for weak IV instruments in R.

https://github.com/beniaminogreen/cragg

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary

Keywords

instrumental-variable iv ivreg2 r regression weak-instruments
Last synced: 5 months ago · JSON representation

Repository

Test for weak IV instruments in R.

Basic Info
  • Host: GitHub
  • Owner: beniaminogreen
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 992 KB
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
instrumental-variable iv ivreg2 r regression weak-instruments
Created about 5 years ago · Last pushed over 4 years ago
Metadata Files
Readme License

README.md

Cragg

Build
Status Codecov License: GPL
v3 CRAN Downloads

An R package to implement the Cragg-Donald test for weak instruments.

Overview

The Cragg-Donald (1993) test is a common way to test for weak instruments in an IV regression but has never been implemented in R. The cragg package provides an implementation of the Cragg-Donald test in R and provides access to the critical values for the Cragg-Donald statistic developed in Stock and Yogo (Stock 2005). These tests quantify the degree to which weak instruments can undermine regression estimates for models with multiple endogenous variables / treatments.

Main Features

  • Calculates Cragg-Donald statistics for weak instruments.

  • Recommends critical values for the Cragg-Donald Statistic based on the largest allowable bias relative to regular OLS or the maximum allowable size distortion of the Wald test statistic.

Installation

r install.packages("cragg") library(cragg)

Usage

The cragg package has two main functions cragg_donald(), and stock_yogo_test().

cragg_donald() implements the Cragg-Donald test for weak instruments in R. It can be thought of as the matrix-equivalent of the first-stage F-test for weak instruments, and is used to evaluate models with multiple endogenous variables. This function has been tested against the results from STATA’s ivreg2 package (Baum, Mark, Stillman 2002) to ensure accuracy.

The syntax is show below:

``` r library(cragg)

Cragg-Donald Test

craggdonald( ~X1+X2+X3, #Controls ~D1 + D2, #Treatments ~Z1 + Z2 + Z3, #Instruments data =exampledata )

> Cragg-Donald test for weak instruments:

>

> Data: example_data

> Controls: ~X1 + X2 + X3

> Treatments: ~D1 + D2

> Instruments: ~Z1 + Z2 + Z3

>

> Cragg-Donald Statistic: 186.1346

> Df: 993

```

stock_yogo_test() implements the Stock and Yogo test for weak instruments. The test developed by Stock and Yogo (2005) is a decision rule meant to ensure that weak instruments do not pose a problem. Stock and Yogo suggest two methods to select the critical values: one based on maximum allowable bias relative to normal OLS and another based on the maximum size of a Wald test on all of the instruments. Both of these decision rules are implemented.

``` r stockyogotest( ~X1+X2+X3, #Controls ~D1, #Treatments ~Z1 + Z2, #Instruments B=.1, #Maximum Allowable Size Distortion sizebias="size", #Calculate critical value for size distortions data =exampledata )

> Results of Stock and Yogo test for weak instruments:

>

> Null Hypothesis: Instruments are weak

> Alternative Hypothesis: Instruments are not weak

>

> Data: example_data

> Controls: ~X1 + X2 + X3

> Treatments: ~D1

> Instruments: ~Z1 + Z2

>

> Alpha: 0.05

> Acceptable level of bias: 10% Wald test distortion.

> Critical Value: 19.93

>

> Cragg-Donald Statistic: 360.5978

> Df: 994

```

References

Baum, Christopher F, Mark E Schaffer, and Steven Stillman. 2002. “IVREG2: Stata module for extended instrumental variables/2SLS and GMM estimation.” Statistical Software Components, Boston College Department of Economics.
Cragg, John G., and Stephen G. Donald. 1993. “Testing Identifiability and Specification in Instrumental Variable Models.” *Econometric Theory* 9 (2): 222–40. .
Stock, James H., and Motohiro Yogo. 2005. “Testing for Weak Instruments in Linear IV Regression.” In *Identification and Inference for Econometric Models*, 80–108. Cambridge University Press. .

Owner

  • Name: Beniamino Green
  • Login: beniaminogreen
  • Kind: user
  • Location: New Haven, CT
  • Company: Yale University

Pre-doctoral Fellow

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 31
  • Total Committers: 1
  • Avg Commits per committer: 31.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Beniamino Green b****n@g****m 31
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago


Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • expm >= 0.999 imports
  • MASS * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests