qregspiv: IV Estimator for the Spatial AR Quantile Model

Description Usage Arguments Details Value References See Also Examples

View source: R/qregspiv.R

Description

Uses the Kim and Muller (2004) or Chernozhukov and Hansen (2006) method to estimate a quantile version of the spatial AR Model

Usage

1
2
3
4
5
 
qregspiv(form,wy=NULL,wmat=NULL,inst=NULL,winst=NULL,shpfile=NULL,
  tau=.5,rhomat=NULL,printsariv=FALSE,silent=FALSE,
  nboot=100,alpha=.05,data=NULL) 
 

Arguments

form

Model formula

wy

The WY variable. Default: not specified; program attempts to calculate WY using wmat or shpfile.

wmat

Directly enter wmat rather than creating it from a shape file. Default: not specified. wmat is needed unless WY is provided and a full instrument list is specified using inst. Default: W = NULL.

inst

List of instruments not to be pre-multiplied by W. Entered as inst=~w1+w2 ... Default: inst=NULL. See details for more information.

winst

List of instruments to be pre-multiplied by W before use. Entered as winst=~w1+w2 ... Default: inst=NULL. See details for more information.

shpfile

Shape file used to construct W based on first order contiguity using a queen criterion. Needed if wmat is not provided when the program requires it.

tau

The quantile. Default: tau = .5

rhomat

A vector of values for ρ. If rhomat=NULL, uses the Kim and Muller (2004) two-stage approach to estimate the model. If rhomat is a vector with two or more entries, uses the Chernozhukov and Hansen (2006) IV approach to estimate the model. Default: rhomat=NULL.

printsariv

If TRUE, also estimates a standard spatial AR model using an IV approach. Instruments for WY are based on the inst and winst options. Default: printsariv=FALSE.

silent

If TRUE, no results are printed. Useful for Monte Carlo.

nboot

The number of simulations for the bootstrap standard errors. Needed for the Kim and Muller (2004) model. Default: nboot=100.

alpha

Probability for the confidence intervals, calculated by the percentile method for the Kim and Muller (2004) model. Default: alpha=.05, i.e., a 95 percent confidence interval.

data

A data frame containing the data. Default: use data in the current working directory.

Details

The procedure is intended for quantile estimation of the spatial AR model, Y = ρ WY + X β + u. It can also be for quantile IV estimation of any model with one endogenous explanatory variable.

Kim and Muller (2004):

The Kim and Muller 2004 estimation procedure is the default. The procedure has two stages. In the first stage, an instrumental variable is constructed for WY using the predicted values from a quantile regression of WY on a set of instruments, Z. The second stage is a quantile regression of Y on X and the predicted values of WY. The same quantile, tau, is used for both regressions.

Standard errors are calculated using a simple bootstrap estimator. New samples are constructed by drawing with replacement from the rows of the data frame holding y, WY, X, and Z. Both stages are re-estimated nboot times using the series of bootstrap samples. The bootstrap standard errors are the standard deviations of the nboot re-calculations of the coefficient estimates. The confidence intervals are based on the percentile method: for any coefficient b, the 1-alpha confidence interval is (quantile(b, alpha/2), quantile(b, 1-alpha/2)).

Chernozhukov and Hansen (2006):

The Chernozhukov and Hansen (2006) procedure is used when a vector of possible values for ρ is specified using the rhomat option, e.g., rhomat = seq(0,.9,.05). The qregspiv command implements a simple version of the Chernzhukov and Hansen estimator in which the explanatory variable WY is replaced by the predicted values from an OLS regression of WY on the instruments, Z. This instrumental variable is then used as an explanatory variable for a series of quantile regressions of Y - ρ WY on X and \hat{WY} – one regression for each value of ρ listed in rhomat. The estimated value of ρ is the value that leads the coefficient on \hat{WY} to be closest to zero. After finding \hat{ρ}, the estimated values of β are calculated by a quantile regression of Y - \hat{ρ} WY on X.

Standard errors are based on equations 3.13 and 3.14 in Chernozhukov and Hansen (2006). Let e represent the residuals from the quantile regression of Y - \hat{ρ} WY on X, and define f_i = I(|e_i|<h)/(2h), where h = 1.06*sd(e)*n^{-.2}. Also, let Φ represent the predicted value of WY from an OLS regression of WY on Z, and let D represent the actual values of WY. Finally, define Φ^*_i = f_iΦ_i and X^*_i = f_iX_i. Then the covariance matrix for \hat{θ} = (\hat{ρ}, \hat{β}) is .

V(\hat{θ}) = J(τ)^{-1}S(τ)(J^t)^{-1}

where J(τ) = ≤ft(\begin{array}{ll}Φ^{*t} D & Φ^{*t} X \\X^{*t} D & X^{*t} X \end{array}\right) and S(τ) = τ(1-τ)≤ft(\begin{array}{ll}Φ^t D & Φ^t X \\X^t D & X^t X \end{array}\right)

Instruments:

By default, the instrument list includes X and WX, where X is the original explanatory variable list and W is the spatial weight matrix. It is also possible to directly specify the full instrument list or to include only a subset of the X variables in the list that is to be pre-multiplied by W. The results of both the quantile IV estimator and the standard IV estimator can be quite sensitive to the choice of instruments for the spatial AR model.

Let list1 and list2 be user-provided lists of the form list=~z1+z2. The combinations of defaults (NULL) and lists for inst alter the final list of instruments as follows:

inst = NULL, winst = NULL: Z = (X, WX)
inst = list1, winst = NULL: Z = list1
inst = NULL, winst = list2: Z = (X, W*list2)
inst = list1, winst = list2: Z = (list1, W*list2)

Note that when inst=list1 and winst=NULL it is up to the user to specify at least one variable in list1 that is not also included in X.

Non-Quantile IV Estimates:

Standard, non-quantile IV estimates are presented if printsariv = T. The first stage is a regression of WY on Z. The second stage is a regression of Y on X and the predicted values of WY. Let \hat{G} be the matrix of explanatory variables in the second stage (i.e., \hat{G} = (Z, \hat{WY} ) ), the covariance matrix is \hat{ σ }^2 (\hat{G}'\hat{G})^{-1} , where \hat{ σ }^2 = e'e/n and e = Y - \hat{ρ} WY - X \hat{β}. Note that the variance calculation uses actual values of WY while (\hat{G}'\hat{G})^{-1} uses predicted values.

Value

A table showing the coefficient estimates, standard errors, and z-values. Also includes a 1-alpha confidence interval based on the percentile method when the Kim and Muller is estimated, i.e., when rhomat = NULL.

References

Chernozhukov, Victor and Christian Hansen, "Instrumental Quantile Regression Inference for Structural and Treatment Effect Models," Journal of Econometrics 132 (2006), 491-525.

Kim, Tae-Hwan and Christophe Muller, "Two-Stage Quantile Regression when the First Stage is Based on Quantile Regression, Econometrics Journal 7 (2004), 218-231.

Koenker, Roger. Quantile Regression. New York: Cambridge University Press, 2005.

Kostov, Philip, "A Spatial Quantile Regression Hedonic Model of Agricultural Land Prices," Spatial Economic Analysis 4 (2009), 53-72.

Zietz, Joachim, Emily Norman Zietz, and G. Stacy Sirmans, "Determinants of House Prices: A Quantile Regression Approach," Journal of Real Estate Finance and Economics 37 (2008), 317-333.

See Also

sarml

qregbmat

qregsim1

qregsim2

qregcpar

qreglwr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(matchdata)
set.seed(4849189)
mdata <- matchdata[matchdata$year==2005,]
obs <- sample(seq(1,nrow(mdata)),400)
mdata <- mdata[obs,]
mdata$age <- 2005 - mdata$yrbuilt
lmat <- cbind(mdata$longitude,mdata$latitude)

fit <- makew(coormat=lmat,method="ring",ringdist=.50)
wmat <- fit$wmat
form <- lnprice~lnland+lnbldg
fit <- qregspiv(form,wmat=wmat,data=mdata,tau=.5)

Example output

Loading required package: lattice
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: quantreg
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

Loading required package: RANN
Loading required package: Matrix
Kim and Muller Two-Stage Quantile Regression Results 
                 Coef. Bootstrap SE Bootstrap Z-values     Pr(>|z|)
(Intercept)  8.4881419   2.10465341          4.0330355 5.506095e-05
lnland       0.2925890   0.02545422         11.4947155 0.000000e+00
lnbldg       0.3522315   0.03766744          9.3510860 0.000000e+00
WY          -0.0461534   0.17604059         -0.2621747 7.931867e-01
            Percentile-Lo Percentile-Hi
(Intercept)     4.6486551    11.8725932
lnland          0.2330281     0.3401044
lnbldg          0.2913177     0.4445547
WY             -0.3434926     0.2875308

McSpatial documentation built on May 2, 2019, 9:32 a.m.