| ivregranks | R Documentation |
Fit instrumental-variable regression involving ranks by two-stage least squares (2SLS). This is equivalent to direct instrumental-variables estimation when the number of instruments is equal to the number of regressors.
ivregranks(
formula,
data,
subset,
na.action,
weights,
offset,
contrasts = NULL,
model = TRUE,
y = TRUE,
x = FALSE,
method = "OLS",
omega = 1,
...
)
## S3 method for class 'ivregranks'
plot(x, which = 1, ...)
## S3 method for class 'ivregranks'
predict(object, newdata, ...)
## S3 method for class 'ivregranks'
summary(object, vcov. = NULL, df = NULL, diagnostics = NULL, ...)
## S3 method for class 'summary.ivregranks'
print(x, ...)
## S3 method for class 'ivregranks'
confint(
object,
parm,
level = 0.95,
component = c("stage2", "stage1"),
complete = TRUE,
vcov. = NULL,
df = NULL,
...
)
## S3 method for class 'ivregranks'
vcov(object, component = c("stage2", "stage1"), complete = TRUE, ...)
formula |
formula specification(s) of the regression
relationship and the instruments. |
data |
an optional data frame containing the variables in the model.
By default the variables are taken from the environment of the
|
subset |
currently not supported. |
na.action |
currently not supported. |
weights |
currently not supported. |
offset |
an optional offset that can be used to specify an a priori known component to be included during fitting. |
contrasts |
an optional list. See the |
model, x, y |
logicals. If |
method |
the method used to fit the stage 1 and 2 regression:
|
omega |
real number in the interval [0,1] defining how ties are handled (if there are any). |
... |
further arguments passed to |
which |
As in |
object |
An object of class |
newdata |
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. |
vcov. |
Optionally either a coefficient covariance matrix or a function to compute such a covariance
matrix from fitted |
df |
For |
diagnostics |
currently not supported. |
parm |
parameters for which confidence intervals are to be computed; a vector or numbers or names; the default is all parameters. |
level |
confidence level; the default is |
component |
Character indicating |
complete |
logical indicating if the full variance-covariance matrix
should be returned also in case of an over-determined system where
some coefficients are undefined and |
Regressors and instruments for ivregranks are most easily specified
in a formula with two parts on the right-hand side, e.g.,
r(y) ~ x1 + r(x2) | r(z1) + z2 + z3, where x1 and r(x2)
are the explanatory variables and r(z1), z2, and z3 are
the instrumental variables. Note that exogenous regressors have to be
included as instruments for themselves.
For example, if there is
one exogenous regressor ex and one endogenous regressor r(en)
with instrument r(in), the appropriate formula would be r(y) ~
r(en) + ex | r(in) + ex. Alternatively, a formula with three parts on the
right-hand side can also be used: r(y) ~ ex | r(en) | r(in).
The latter is typically more convenient, if there is a large number of
exogenous regressors.
Moreover, two further equivalent specification strategies are possible that
are typically less convenient compared to the strategies above. One option
is to use an update formula with a . in the second part of the formula
is used: r(y) ~ r(en) + ex | . - r(en) + r(in). Another option is to
use a separate formula for the instruments (only for backward compatibility
with earlier versions):
formula = r(y) ~ r(en) + ex, instruments = ~ r(in) + ex.
Internally, all specifications are converted to the version with two parts on the right-hand side.
ivregranks returns an object of class "ivregranks" that
inherits as much as possible from class ivreg,
with the following additional components:
rank_terms_indices |
an integer vector with indices of entries of
|
rank_instruments_indices |
an integer vector with indices of entries of the ranked instrumental variables. |
ranked_response |
a logical entry. |
omega |
an entry corresponding to the |
plot(ivregranks): Plot diagnostics for an ivregranks object
Displays plots useful for assessing quality of model fit. Currently, only one plot is available, which plots fitted values against residuals (for homoscedacity check).
predict(ivregranks): Predict method for IV Model for Ranks Fits
summary(ivregranks): Summary and Inference Methods for "ivregranks"
Objects
vcov(ivregranks): Calculate Variance-Covariance Matrix for a Fitted
ivregranks object
Returns the variance-covariance matrix of the regression coefficients
(main parameters) of a fitted ivregranks object. Its result is
theoretically valid and asymptotically consistent, in contrast to naively
running vcov(ivreg(...)).
Chetverikov and Wilhelm (2023), "Inference for Rank-Rank Regressions". arXiv preprint arXiv:2310.15512
ivreg.fit, lmranks
Generic functions coef, residuals,
fitted, model.frame,
model.matrix, update .
# rank-rank regression:
Z <- rnorm(500)
X <- Z + rnorm(500)
Y <- X + rnorm(500)
rrfit <- ivregranks(r(Y) ~ r(X) | r(Z))
summary(rrfit)
# naive version of the rank-rank regression:
RZ <- frank(Z, increasing = TRUE, omega = 1)
RX <- frank(X, increasing = TRUE, omega = 1)
RY <- frank(Y, increasing = TRUE, omega = 1)
fit <- ivreg::ivreg(RY ~ RX | RZ)
summary(fit)
# the coefficient estimates are the same as in the ivregranks function, but
# the standard errors, t-values, p-values are incorrect.
# support for `data` argument:
ivr <- ivregranks(r(mpg) ~ r(hp) + cyl | r(disp) + cyl, data = mtcars)
summary(ivr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.