"ivreg"
ObjectsMethods 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 ivreg
influence(
model,
sigma. = n <= 1000,="" type="c("stage2"," "both",="" "maximum"),="" applyfun="NULL," ncores="NULL," ...="" )<="" p=""># S3 method for ivreg
rstudent(model, ...)
# S3 method for ivreg
cooks.distance(model, ...)
# S3 method for influence.ivreg
dfbeta(model, ...)
# S3 method for ivreg
dfbeta(model, ...)
# S3 method for ivreg
hatvalues(model, type = c("stage2", "both", "maximum", "stage1"), ...)
# S3 method for influence.ivreg
rstudent(model, ...)
# S3 method for influence.ivreg
hatvalues(model, ...)
# S3 method for influence.ivreg
cooks.distance(model, ...)
# S3 method for influence.ivreg
qqPlot(
x,
ylab = paste("Studentized Residuals(", deparse(substitute(x)), ")", sep = ""),
distribution = c("t", "norm"),
...
)
# S3 method for ivreg
influencePlot(model, ...)
# S3 method for influence.ivreg
influencePlot(model, ...)
# S3 method for ivreg
infIndexPlot(model, ...)
# S3 method for influence.ivreg
infIndexPlot(model, ...)
# S3 method for influence.ivreg
model.matrix(object, ...)
# S3 method for ivreg
avPlots(model, terms, ...)
# S3 method for ivreg
avPlot(model, ...)
# S3 method for ivreg
mcPlots(model, terms, ...)
# S3 method for ivreg
mcPlot(model, ...)
# S3 method for ivreg
Boot(
object,
f = coef,
labels = names(f(object)),
R = 999,
method = "case",
ncores = 1,
...
)
# S3 method for ivreg
crPlots(model, terms, ...)
# S3 method for ivreg
crPlot(model, ...)
# S3 method for ivreg
ceresPlots(model, terms, ...)
# S3 method for ivreg
ceresPlot(model, ...)
# S3 method for ivreg
plot(x, ...)
# S3 method for ivreg
qqPlot(x, distribution = c("t", "norm"), ...)
# S3 method for ivreg
outlierTest(model, ...)
# S3 method for ivreg
spreadLevelPlot(x, main = "Spread-Level Plot", ...)
# S3 method for ivreg
ncvTest(model, ...)
# S3 method for ivreg
deviance(object, ...)
# S3 method for rivreg
influence(model, ...)
=>
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.
A "ivreg"
or "influence.ivreg"
object.
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.
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.
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).
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
mclapply
mclapply
(otherwise) with the desired number of cores.
arguments to be passed down.
The vertical axis label.
"t"
(the default) or "norm"
.
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.
see Boot
.
only "case"
(case resampling) is supported: see Boot
.
Main title for the graph.
ivreg
, avPlots
,
crPlots
, predictorEffects
,
qqPlot
, influencePlot
,
infIndexPlot
, Boot
,
outlierTest
, spreadLevelPlot
,
ncvTest
.
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)
Run the code above in your browser using DataLab