help min_cv_mkern

Title

min_cv_mkern - Optimal bandwidth for multivariate nonparametric kernel regression

Syntax

min_cv_mkern
outcome
covariates,
k(kerneltype)
modeltype(modeltype)
[cvfile(filename)
graph]

Description

min_cv_mkern computes the "optimal bandwidth" for the multivariate nonparametric
local kernel regression implemented via the command mkern. min_cv_mkern
finds the bandwidth minimizing the Integrated Mean Square Error (IMSE)
through a (computational) cross-validation (CV) approach.

According to the min_cv_mkern syntax:

outcome: is the dependent variable.

covariates: is the set of covariates predicting the outcome.

k(kerneltype): specifies the type of kernel function to use.

model(modeltype): specifies the type of smoothing techniques to use. It may be either
"mean" (i.e., kernel local mean), or "linear" (i.e., kernel local linear).

Options

cvfile(filename): allows to store cross-validation results in filename.dta.

graph: provides a graphical plot of the cross-validation loss function against the grid of bandwidths.

kerneltype_options

kern
epanechnikov uses a Epanechnikov kernel

epan2 uses a Epan2 kernel

gaussian uses a Normal kernel

biweight uses a Biweight (or Quartic) kernel

rectangle uses a Uniform kernel

triangle uses a Triangular kernel

tricube uses a Tricube kernel

parzen uses a Parzen kernel

cosine uses a Cosine kernel

triweight uses a Triweight kernel

modeltype_options

model
mean Smoothing technique: kernel local mean

linear Smoothing technique: kernel local linear

min_cv_mkern returns the following objects:

e(opt_bandw) is a scalar containing the optimal bandwidth.

e(min_CV) is a a scalar containing the minimum of the cross-validation loss function.

Remarks

- Please remember to use the update query command before running
this program to make sure you have an up-to-date version of Stata installed.

Example

*** Example 1 ***
. global KERNEL "parzen"
. global MODEL "linear"
. global y "price"
. global xvars "mpg weight trunk"
. sysuse auto , clear
*1.Compute the "optimal bandwidth"
. min_cv_min_cv_mkern $y $xvars , kern($KERNEL) modeltype($MODEL)
. global H=e(opt_bandw)
*2.Compute the "multivariate kernel fitted values"
. min_cv_mkern $xvars , y($y) y_fit(y_fitted) h($H) k($KERNEL) model($MODEL) graph

*** Example 2 ***
. global KERNEL "parzen"
. global MODEL "linear"
. use http://www.stata-press.com/data/r14/motorcycle , clear
*1.Compute the "optimal bandwidth"
. min_cv_min_cv_mkern accel time , kern($KERNEL) modeltype($MODEL)
. global H=e(opt_bandw)
*2.Compute the "multivariate kernel fitted values"
. min_cv_mkern time , y(accel) y_fit(y_fitted) h($H) k($KERNEL) model($MODEL)
*3.Plot the results
. tw (scatter accel time ) (mspline y_fitted time)

References

Li, Q., Racine, J.S., 2006. Nonparametric Econometrics: Theory and Practice. Princeton University Press.

Pagan, A., Ullah, A., 1999. Nonparametric econometrics. Cambridge University Press: Cambridge, UK.

Hastie, T., Tibshirani, R., Freedman J., 2001. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer, New York.

Author

Giovanni Cerulli

IRCrES-CNR

Research Institute on Sustainable Economic Growth, National Research Council of Italy

E-mail: giovanni.cerulli@ircres.cnr.it

Also see

Online: mkern, lpoly, locreg, npregress