Skip to main content

Nonparametric Regression Using Clusters


We present a fundamentally unique method of nonparametric regression using clusters and test it against classically established methods. We compare two nonlinear regression estimation packages called ‘NNS’, Viole (NNS: nonlinear nonparametric statistics, 2016), and ‘np’, Hayfield and Racine (J Stat Softw 27(5):1–32, 2008), with the help of a simulation using deterministic (DT) and stochastic (ST) regressor models. We find the respective coefficients of determination \((R^2)\) are close for DT models, while finding an advantage to NNS in ST and large sample cases. Regression coefficients are sometimes regarded as approximations to partial derivatives, especially in social sciences. Then, NNS alone has the ability to compute a range of partials evaluated at points within the sample and also out-of-sample. Thus NNS can provide a viable alternative to kernel based nonparametric regressions without using bandwidths for smoothing.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4


  1. In R, we used the variables: >x = seq(0,4*pi,pi/1000);y = sin(x)

  2. There is considerable literature devoted to the topic of boundaries and endpoints in ‘np’, with no consensus as to how to best handle them.

  3. The mean of course is defined as the sum of weighted observations, weighted by 1 over the number of all observations. The single observation weighting and quadrant partitions eventually lead to the limit condition of NNS partitioning.

  4. The variance is not directly used in NNS regression. Viole and Nawrocki (2012a) demonstrate the covariance matrix equivalence from NNS partitioning and it is mentioned here in order to further exemplify NNS partitioning’s robustness.

  5. The use of explicit linear regressions within segments is avoided by NNS since it cannot reach such limits. This is because one needs a minimum number of observations for a sensible regression fit. Empty segments are ignored by NNS.

  6. The R code for simulation is available on GitHub: The NNS R routines are also available on GitHub:


  • Bawa, V. S. (1975). Optimal rules for ordering uncertain prospects. Journal of Financial Economics, 2(95), 121.

    Google Scholar 

  • Bellman, R. (1961). On the approximation of curves by line segments using dynamic programming. Communications of the ACM, 4(6), 284.

    Article  Google Scholar 

  • Bock, H.-H. (2008). Origins and extensions of the -means algorithm in cluster analysis. Journal lectronique d’Histoire des Probabilits et de la Statistique [electronic only], 4(2), 14–181418.

  • Doksum, K., & Samarov. A. (1995). Nonparametric estimation of global functionals and a measure of the explanatory power of covariates in regression. Annals of Statistics, 23(5), 1443–1473.

    Article  Google Scholar 

  • Hayfield, T., & Racine, J. S. (2008). Nonparametric econometrics: The np package. Journal of Statistical Software, 27(5), 1–32.

  • Li, Q., & Racine, J. S. (2007). Nonparametric econometrics. Princeton: Princeton University Press.

    Google Scholar 

  • Stone, H. (1961). Approximation of curves by line segments. Mathematics of Computation, 15(73), 40–47.

    Article  Google Scholar 

  • Vinod, H. D. (2008). Hands-on intermediate econometrics using R: Templates for ex- tending dozens of practical examples. Hackensack, NJ: World Scientific. ISBN 10-981-281-885-5.

  • Vinod, H. D., & Reagle, D. (2005). Preparing for the worst: Incorporating downside risk in stock market investments (monograph). New York: Wiley.

    Google Scholar 

  • Vinod, H. D., & Ullah, A. (1993). General nonparametric regression estimation and testing in econometrics. In G. S. Maddala, C. R. Rao, & H. D. Vinod (Eds.), Handbook of statistics: Econometrics (Vol. 11, pp. 85–116). New York: North Holland, Elsevier.

    Google Scholar 

  • Viole, F. (2016a). Beyond correlation: Using the elements of variance for conditional means and probabilities. SSRN eLibrary.

  • Viole, F. (2016b). NNS: Nonlinear nonparametric statistics. R package version 0.3.3.

  • Viole, F, & Nawrocki, D. (2012a). Cumulative distribution functions and UPM/LPM analysis. SSRN eLibrary.

  • Viole, F., & Nawrocki, D. (2012b). Deriving nonlinear correlation coefficients from partial moments. SSRN eLibrary.

Download references


We would like to thank the anonymous referees providing valuable commentary on earlier versions of this manuscript.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Hrishikesh D. Vinod.

Rights and permissions

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Vinod, H.D., Viole, F. Nonparametric Regression Using Clusters. Comput Econ 52, 1317–1334 (2018).

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: