Skip to contents

Computes the Cragg-Donald (1993) weak-instrument statistic. The statistic is a function of the first-stage regression and is independent of the outcome variable; outcome only needs to name a numeric column in data so ivreg can compile a formula. When outcome = NULL (default), the first endogenous regressor is reused as the outcome – works because ivreg's weak-IV diagnostic comes from the first stage regardless of y.

Usage

morie_iv_cragg_donald(
  data,
  endogenous,
  instruments,
  exogenous = NULL,
  outcome = NULL
)

Arguments

data

Data frame.

endogenous

Character vector of endogenous regressor names.

instruments

Character vector of excluded-instrument names.

exogenous

Optional exogenous covariates.

outcome

Optional outcome column name. Default NULL reuses endogenous[1]; the resulting F-statistic is unaffected because Cragg-Donald only reads the first stage.

Value

Named list with statistic, p_value, name, details.

Examples

set.seed(1); n <- 300
z <- rbinom(n, 1, 0.5); u <- rnorm(n)
d <- rbinom(n, 1, plogis(0.8 * z + 0.3 * u))
df <- data.frame(d, z)
morie_iv_cragg_donald(df, "d", "z")
#> $statistic
#> [1] 12.63993
#> 
#> $p_value
#> [1] 0.0004389767
#> 
#> $name
#> [1] "Cragg-Donald (first-stage F)"
#> 
#> $details
#> $details$first_stage
#>   endogenous        F partial_R2 n_instruments
#> 1          d 12.63993 0.04068997             1
#> 
#> $details$df1
#> [1] 1
#> 
#> $details$df2
#> [1] 298
#> 
#> $details$k_endogenous
#> [1] 1
#> 
#> $details$k_instruments
#> [1] 1
#> 
#> $details$k_exogenous
#> [1] 0
#> 
#> $details$outcome_used
#> [1] NA
#> 
#>