Last chance! 50% off unlimited learning
Sale ends in
qregcdf(form,taumat=c(.10,.25,.50,.75,.90),hx=0,hy=0,nx=20,ny=100, targetx=0,targety=0,graph.target=FALSE,graph.yhat=FALSE, data=NULL)
The estimation procedure begins by evaluating this expression at each point in the grid determined by the values of target.x and target.y
The result is an nx x ny matrix of values for F(y|x). Let $fxj$ represent the ny-vector of values of $F(y|xj)$, and let $fk$ indicate the entry of $F(y|xj)$ associated with $yk$, k = 1,...,ny. Finally, let $tau$ represent an entry of taumat. Then the value of yhat.target associated with quantile $tau$ and $xj$ is the largest value of $fk$ such that $fk < tau < fk+1$. The resulting nx x length(taumat) matrix is available after estimation as yhat.target. The smooth12 is used to interpolate each column of yhat.target to span the full vector of original values of x. The result is the n x length(taumat) matrix yhat.
Note: The default bandwidth may prove too small if there are regions where x is sparse. It may be necessary to experiment with larger bandwidths for hx and hy. The function qreglwr is more flexible, allowing nearest neighbor approaches as well as fixed bandwidths.
data(dupage99)
dupage99$ratio <- dupage99$av/dupage99$price
o <- order(dupage99$price)
dupage99 <- dupage99[o,]
attach(dupage99)
price <- price/1000
fit <- qregcdf(ratio~price)
ymin = min(fit$yhat)
ymax = max(fit$yhat)
plot(price, fit$yhat[,1],type="l",xlab="Sales Price (1000s)",ylab="Assessment Ratio",
ylim=c(ymin,ymax),main="Nonparametric Conditional CDF Quantile Regression")
for (j in seq(2,5)) {
lines(price,fit$yhat[,j])
}
fit$hx
fit$hy
Run the code above in your browser using DataLab