View source: R/kern_smooth_bw.R
kern_smooth_bw | R Documentation |
The function kern_smooth_bw
provides two bandwidth selection methods. One is the least squares cross-validation developed by Parmeter and Racine (2013). The other is the BIC developed in Noh (2014).
kern_smooth_bw(xtab, ytab, method="u", technique="noh", bw_method="bic",
control = list("tm_limit" = 700))
xtab |
a numeric vector containing the observed inputs |
ytab |
a numeric vector of the same length as |
method |
a character equal to "u" (unconstrained estimator), "m" (under the monotonicity constraint) or "mc" (under simultaneous monotonicity and concavity constraints). |
technique |
which estimation technique to use: "Noh" specifies the use of the method in Noh (2014), while "pr" is for the method in Parameter and Racine (2013). |
bw_method |
which bandwidth selection method to use: "cv" returns the bandwidth that minimizes the least squares cross-validation criterion, and "bic" returns the bandwidth minimizing the BIC. |
control |
a list of parameters to the GLPK solver. See *Details* of help(Rglpk_solve_LP). |
As with any smoothed techniques, the bandwidth selection is critical to the quality of the frontier estimator. Parmeter and Racine (2013)'s recommendation is to use the least squares cross-validation method implemented with bw\_method="cv"
in the function kern\_smooth\_bw
.
Instead, Noh (2014) proposed to select the bandwidth which minimizes the following criterion:
BIC(h) = \log \left( \sum_{i=1}^n (\hat \varphi(x_i|\hat p(h))-y_i)\right)+\frac {\log n \cdot tr(S(h))}{2n},
where \hat p(h)
is the chosen weight vector associated to the bandwidth h
, and tr(S(h))
is the trace of the smoothing matrix
S(h) = \left( \begin{array}{ccc} A_1(x_1) & \cdots & A_n(x_1)
\\ \vdots & \ddots& \vdots
\\ A_1(x_n) & \cdots & A_n(x_n) \end{array} \right).
The function kern\_smooth\_bw
computes the optimal bandwidth from this criterion with option bw\_method="bic"
.
Returns an optimal bandwidth depending on the specified selection method.
Hohsuk Noh
Noh, H. (2014). Frontier estimation using kernel smoothing estimators with data transformation. Journal of the Korean Statistical Society, 43, 503-512.
Parmeter, C.F. and Racine, J.S. (2013). Smooth constrained frontier analysis in Recent Advances and Future Directions in Causality, Prediction, and Specification Analysis, Springer-Verlag, New York, 463-488.
kern_smooth
.
## Not run:
data("green")
x.green <- seq(min(log(green$COST)), max(log(green$COST)),length.out=101)
options(np.tree=TRUE,crs.messages=FALSE,np.messages=FALSE)
h.pr.green.m<-kern_smooth_bw(log(green$COST),log(green$OUTPUT), method="m",
technique="pr", bw_method="cv")
h.noh.green.m<-kern_smooth_bw(log(green$COST),log(green$OUTPUT), method="m",
technique="noh", bw_method="bic")
y.pr.green.m<-kern_smooth(log(green$COST),log(green$OUTPUT), x.green,
h=h.pr.green.m, method="m", technique="pr")
y.noh.green.m<-kern_smooth(log(green$COST),log(green$OUTPUT), x.green,
h=h.noh.green.m, method="m", technique="noh")
plot(log(OUTPUT)~log(COST), data=green, xlab="log(COST)",ylab="log(OUTPUT)")
lines(x.green, y.pr.green.m, lwd=4, lty=3, col="red")
lines(x.green, y.noh.green.m, lwd=4, lty=3, col="blue")
legend("topleft", col=c("blue","red"),lty=3, legend=c("noh","pr"),
lwd=4, cex=0.8)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.