.- help for ^kernreg^ [STB-30: snp9] .- Kernel regression (Nadaraya-Watson estimator) --------------------------------------------- ^kernreg^ yvar xvar [^if^ exp] [^in^ range], ^b^width^(^#^)^ ^k^ercode^(^#^)^ ^np^oint^(^#^)^ [^g^en^(^mhvar gridvar^)^ ^nog^raph graph_options] Description ----------- ^kernreg^ calculates the Nadaraya-Watson nonparametric regression. By default, ^kernreg^ draws the graph of the estimated conditional mean over the grid points used for calculation connected by a line without any symbol. Options ------- ^b^width^(^#^)^ specifies the smoothing parameter (bandwidth or halfwidth) of the kernel density estimation for ^xvar^. This parameter defines the width of the weight function window around each grid point. ^k^ercode^(^#^)^ specifies the weight function (kernel) to calculate the required univariate densities according to the following numerical codes: 1 = Uniform 2 = Triangle 3 = Epanechnikov 4 = Quartic (Biweight) 5 = Triweight 6 = Gaussian 7 = Cosinus ^np^oint^(^#^)^ specifies the number of equally spaced points (which define a grid) in the range of ^xvar^ used for the regression estimation. ^g^en^(^mhvar gridvar^)^ creates two variables containing the estimated regression (conditional mean) values and the corresponding grid points, respectively. ^nog^raph suppresses the graph. graph_options are any of the options allowed with ^graph, twoway^. Remarks ------- ^b^width, ^k^ercode, and ^np^point are not optional. If the user does not provide them, the program halts and displays an error message on screen. This program uses kernel density estimators modified from Salgado-Ugarte, et al. (1993) and based on the equations provided by Haerdle (1991) and Scott (1992). The smoothness of the resulting estimate can be regulated by changing the bandwidth: wide intervals produce smooth results; narrow intervals give noisier estimates. Except for the Gaussian kernel, all the functions are supported on [-1,1]. While using the ^gen^ option, if the number of cases is less than ^np^oint then the program sets the number of the observations = ^np^oint to obtain the full set of estimations. This procedure can be regarded as a descriptive smoother of scatterplots as well as a nonparametric regression estimator (Nadaraya-Watson). Examples -------- . ^kernreg wait dura, bwidth(0.65) kercode(4) npoint(100)^ . ^kernreg accel time, b(2.4) k(4) np(100) gen(m2p4 g2p4) nog^ References ---------- Chambers, J.M., W.S. Cleveland, B. Kleiner and P.A. Tukey. 1983. Graphical methods for data analysis. Wadsworth & Brooks/Cole. Fox, J. 1990. Describing univariate distributions. In (Fox, J. & J. S. Long, eds.) Modern Methods of Data Analysis. Sage. Haerdle, W. 1991. Smoothing techniques with implementation in S. Springer-Verlag. Salgado-Ugarte, I.H., M. Shimizu, and T. Taniuchi. 1993. snp6: Exploring the shape of univariate data using kernel density estimators. Stata Technical Bulletin 16: 8-19. Salgado-Ugarte, I. H., M. Shimizu, and T. Taniuchi 1995. snp6.1: ASH, WARPing, and kernel density estimation for univariate data. Stata Technical Bulletin 26: 23-31. Salgado-Ugarte, I. H., M. Shimizu, and T. Taniuchi 1995. snp6.2: Practical rules for bandwidth selection in univariate density estimation. Stata Technical Bulletin 27: 5-19. Scott, D. W. 1992. Multivariate density estimation: Theory, practice, and visualization. John Wiley & Sons. Silverman, B. W. 1986. Density estimation for statistics and data analysis. Chapman and Hall. Authors ------- Isaias H. Salgado-Ugarte, Makoto Shimizu and Toru Taniuchi University of Tokyo, Faculty of Agriculture, Department of Fisheries, Yayoi 1-1-1, Bunkyo-ku Tokyo 113, Japan. fes01@@tzetzal.dcaa.unam.mx Also see -------- STB: STB-30 snp9, STB-27 snp6.2, STB-26 snp6.1, STB-16 snp6 On-line: ^help^ for @kerneld@, @warpden@, @warpdens@, @warpreg@, @gwarpreg@