Finds robust instrumental variables estimator using high breakdown point multivariate location and scatter matrix Sestimators.
1 2 
Y 
vector of responses. 
Xend 
matrix of the endogenous variables, i.e. covariates that are correlated with the regression's error term. 
Xex 
matrix of the exogenous variables, i.e. covariates that are
uncorrelated with the regression's error term. Default =

Zinst 
matrix of instruments, variables correlated with the endogenous covariates, but uncorrelated with the error term. The number of instrumental variables needs to be larger than or equal to the number of endogenous covariates. 
dummies 
matrix of exogenous dummy covariates, i.e., where each D_i are 0–1 vectors. 
method 
the method to be used. The " 
For method "Sest
", RIV is constructed using the
robust multivariate location and scatter Sestimator based on
the Tukey's biweight function (see CovSest
).
If RIV is computed using the Sestimator, its variancecovariance matrix is estimated based on the empirical influence function. See references for more details.
For method "SDest
", RIV is constructed using the
StahelDonoho's robust multivariate location and scatter estimator (see
CovSde
).
For method "MCDest
", RIV is constructed using the
Minimum Covariance Determinant (MCD) robust multivariate
location and scatter estimator (see CovMcd
).
For method "classical
", the estimator is the classical
instrumental variables estimator based on the sample mean and sample
variancecovariance matrix (also known as the twostage least squares estimator, 2SLS).
If the model contains dummy variables (i.e., dummies != NULL
),
RIV is computed using an iterative algorithm called "L_1RIV".
Briefly, L_1RIV estimates the coefficients of the dummies using
an L_1estimator and the coefficients of the continuous
covariates using the original RIV. See Cohen Freue et al. for more
details.
A list with components:
Summary.Table 
Matrix of information available about the
estimator. It contains regression coefficients, and, for

VC 
estimated variancecovariance matrix, computed only if

MD 
Squared Mahalanobis distances of each observation to the
multivariate location Sestimator with respect to the scatter
Sestimator (only computed if 
MSE 
vector of three components, computed only if

weight 
the weights assigned by RIV to each observation (only
computed if 
LOPUHAA H.P. (1989). On the Relation between Sestimators and Mestimators of Multivariate Location and Covariance. Ann. Statist. 17 16621683.
COHENFREUE, G.V., ORTIZMOLINA, H., and ZAMAR, R.H. (2012) A Natural Robustification of the Ordinary Instrumental Variables Estimator. Submitted to Biometrics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45  ## load data earthquake: the first column contains the response (Y), the
## second the endogenous variable (X) and the third column is the
## instrument (W).
data(earthquake)
riv.eq < riv(earthquake$Y,earthquake$X,NULL,earthquake$W)
## plot of the RIV estimates and the outlying observations are
## identified by filled points
plot(earthquake$X,earthquake$Y,xlab="X",ylab="Y",cex=1.5)
abline(riv.eq$Summary.Table[,1])
outliers < which(sqrt(riv.eq$MD)>sqrt(qchisq(0.99, 3)))
text(earthquake[outliers,2],
earthquake[outliers,1],
outliers,
pos=c(4,4,4,2))
points(earthquake[outliers,2],
earthquake[outliers,1],
cex=1.5,pch=19)
## Weights given by RIV to each observation as a function of the square
## root of the Mahalanobis distances (d) of each observation to the
## multivariate location and covariance Sestimator (computed with
## CovSest in rrcov)
plot(sqrt(riv.eq$MD),riv.eq$weight,xlab="d",ylab="RIV's Weights",cex = 1.5)
abline(h=sqrt(qchisq(0.99, 3)))
text(sqrt(riv.eq$MD)[outliers],
riv.eq$weight[outliers],
outliers,
pos=c(2, 1, 1, 4))
points(sqrt(riv.eq$MD)[outliers],
riv.eq$weight[outliers],
cex=1.5, pch=19)
## load data mortality
data(mortality)
Y < as.matrix(mortality[,1]) ## M070
Xex < as.matrix(mortality[,c(2,3,5,6)]) ## MAGE,CI68,DENS,NONW
Xend < as.matrix(mortality[,4]) ## MDOC
colnames(Xend) < colnames(mortality)[4]
Zinst < as.matrix(mortality[,7:8]) ## EDUC,IN69
## Classical instrumental variables estimator
riv(Y, Xend, Xex, Zinst, method="classical")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.