ivregDiagnostics function

Deletion and Other Diagnostic Methods for "ivreg" Objects

Deletion and Other Diagnostic Methods for "ivreg" Objects

Methods for computing deletion and other regression diagnostics for 2SLS regression. It's generally more efficient to compute the deletion diagnostics via the influence

method and then to extract the various specific diagnostics with the methods for "influence.ivreg" objects. Other diagnostics for linear models, such as added-variable plots (avPlots) and component-plus-residual plots (crPlots), also work, as do effect plots (e.g., predictorEffects) with residuals (see the examples below). The pointwise confidence envelope for the qqPlot method assumes an independent random sample from the t distribution with degrees of freedom equal to the residual degrees of freedom for the model and so are approximate, because the studentized residuals aren't independent.

For additional information, see the vignette Diagnostics for 2SLS Regression.

## S3 method for class 'ivreg' influence( model, sigma. = n <= 1000, type = c("stage2", "both", "maximum"), applyfun = NULL, ncores = NULL, ... ) ## S3 method for class 'ivreg' rstudent(model, ...) ## S3 method for class 'ivreg' cooks.distance(model, ...) ## S3 method for class 'influence.ivreg' dfbeta(model, ...) ## S3 method for class 'ivreg' dfbeta(model, ...) ## S3 method for class 'ivreg' hatvalues(model, type = c("stage2", "both", "maximum", "stage1"), ...) ## S3 method for class 'influence.ivreg' rstudent(model, ...) ## S3 method for class 'influence.ivreg' hatvalues(model, ...) ## S3 method for class 'influence.ivreg' cooks.distance(model, ...) ## S3 method for class 'influence.ivreg' qqPlot( x, ylab = paste("Studentized Residuals(", deparse(substitute(x)), ")", sep = ""), distribution = c("t", "norm"), ... ) ## S3 method for class 'ivreg' influencePlot(model, ...) ## S3 method for class 'influence.ivreg' influencePlot(model, ...) ## S3 method for class 'ivreg' infIndexPlot(model, ...) ## S3 method for class 'influence.ivreg' infIndexPlot(model, ...) ## S3 method for class 'influence.ivreg' model.matrix(object, ...) ## S3 method for class 'ivreg' avPlots(model, terms, ...) ## S3 method for class 'ivreg' avPlot(model, ...) ## S3 method for class 'ivreg' mcPlots(model, terms, ...) ## S3 method for class 'ivreg' mcPlot(model, ...) ## S3 method for class 'ivreg' Boot( object, f = coef, labels = names(f(object)), R = 999, method = "case", ncores = 1, ... ) ## S3 method for class 'ivreg' crPlots(model, terms, ...) ## S3 method for class 'ivreg' crPlot(model, ...) ## S3 method for class 'ivreg' ceresPlots(model, terms, ...) ## S3 method for class 'ivreg' ceresPlot(model, ...) ## S3 method for class 'ivreg' plot(x, ...) ## S3 method for class 'ivreg' qqPlot(x, distribution = c("t", "norm"), ...) ## S3 method for class 'ivreg' outlierTest(model, ...) ## S3 method for class 'ivreg' spreadLevelPlot(x, main = "Spread-Level Plot", ...) ## S3 method for class 'ivreg' ncvTest(model, ...) ## S3 method for class 'ivreg' deviance(object, ...) ## S3 method for class 'rivreg' influence(model, ...)

Arguments

  • model, x, object: A "ivreg" or "influence.ivreg" object.

  • sigma.: If TRUE (the default for 1000 or fewer cases), the deleted value of the residual standard deviation is computed for each case; if FALSE, the overall residual standard deviation is used to compute other deletion diagnostics.

  • type: If "stage2" (the default), hatvalues are for the second stage regression; if "both", the hatvalues are the geometric mean of the casewise hatvalues for the two stages; if "maximum", the hatvalues are the larger of the casewise hatvalues for the two stages. In computing the geometric mean or casewise maximum hatvalues, the hatvalues for each stage are first divided by their average (number of coefficients in stage regression/number of cases); the geometric mean or casewise maximum values are then multiplied by the average hatvalue from the second stage.

  • applyfun: Optional loop replacement function that should work like lapply with arguments function(X, FUN, ...). The default is to use a loop unless the ncores argument is specified (see below).

  • ncores: Numeric, number of cores to be used in parallel computations. If set to an integer the applyfun is set to use either parLapply

    (on Windows) or (otherwise) with the desired number of cores.

  • ...: arguments to be passed down.

  • ylab: The vertical axis label.

  • distribution: "t" (the default) or "norm".

  • terms: Terms for which added-variable plots are to be constructed; the default, if the argument isn't specified, is the "regressors" component of the model formula.

  • f, labels, R: see Boot.

  • method: only "case" (case resampling) is supported: see Boot.

  • main: Main title for the graph.

Returns

In the case of influence.ivreg, an object of class "influence.ivreg"

with the following components:

  • coefficients: the estimated regression coefficients
  • model: the model matrix
  • dfbeta: influence on coefficients
  • sigma: deleted values of the residual standard deviation
  • dffits: overall influence on the regression coefficients
  • cookd: Cook's distances
  • hatvalues: hatvalues
  • rstudent: Studentized residuals
  • df.residual: residual degrees of freedom

In the case of other methods, such as rstudent.ivreg or rstudent.influence.ivreg, the corresponding diagnostic statistics. Many other methods (e.g., crPlot.ivreg, avPlot.ivreg, Effect.ivreg) draw graphs.

Examples

kmenta.eq1 <- ivreg(Q ~ P + D | D + F + A, data = Kmenta) summary(kmenta.eq1) car::avPlots(kmenta.eq1) car::mcPlots(kmenta.eq1) car::crPlots(kmenta.eq1) car::ceresPlots(kmenta.eq1) car::influencePlot(kmenta.eq1) car::influenceIndexPlot(kmenta.eq1) car::qqPlot(kmenta.eq1) car::spreadLevelPlot(kmenta.eq1) plot(effects::predictorEffects(kmenta.eq1, residuals = TRUE)) set.seed <- 12321 # for reproducibility confint(car::Boot(kmenta.eq1, R = 250)) # 250 reps for brevity car::outlierTest(kmenta.eq1) car::ncvTest(kmenta.eq1)

See Also

ivreg, avPlots, crPlots, predictorEffects, qqPlot, influencePlot, infIndexPlot, Boot, outlierTest, spreadLevelPlot, ncvTest.

  • Maintainer: Achim Zeileis
  • License: GPL (>= 2)
  • Last published: 2025-01-19