[Paper Review] pyStoNED: A Python Package for Convex Regression and Frontier Estimation
This paper introduces pyStoNED, a free, open-source Python package that enables convex regression and frontier estimation using nonparametric methods such as multivariate convex nonparametric least squares (CNLS), convex quantile and expectile regression, isotonic regression, and stochastic nonparametric envelopment (StoNED). It addresses the computational burden and lack of accessible tools in efficiency analysis by providing a user-friendly, fully open-access framework for estimating cost and production frontiers with shape constraints, supporting both additive and multiplicative error structures via QP and NLP solvers.
Shape-constrained nonparametric regression is a growing area in econometrics, statistics, operations research, machine learning and related fields. In the field of productivity and efficiency analysis, recent developments in the multivariate convex regression and related techniques such as convex quantile regression and convex expectile regression have bridged the long-standing gap between the conventional deterministic-nonparametric and stochastic-parametric methods. Unfortunately, the heavy computational burden and the lack of powerful, reliable, and fully open access computational package has slowed down the diffusion of these advanced estimation techniques to the empirical practice. The purpose of the Python package pyStoNED is to address this challenge by providing a freely available and user-friendly tool for the multivariate convex regression, convex quantile regression, convex expectile regression, isotonic regression, stochastic nonparametric envelopment of data, and related methods. This paper presents a tutorial of the pyStoNED package and illustrates its application, focusing on the estimation of frontier cost and production functions.
Motivation & Objective
- To address the lack of accessible, reliable, and fully open-source computational tools for advanced nonparametric frontier estimation methods in efficiency and productivity analysis.
- To bridge the gap between deterministic nonparametric (DEA) and stochastic parametric (SFA) approaches by implementing the unified StoNED framework in a user-friendly Python package.
- To reduce the computational barrier of convex regression techniques by providing efficient, scalable, and well-documented implementations of CNLS, convex quantile, and expectile regression.
- To support both additive and multiplicative error structures in frontier models, enabling robust estimation of production and cost functions under shape constraints.
- To promote wider adoption of advanced nonparametric methods in empirical research by offering a fully open-access, extensible, and interoperable software solution.
Proposed method
- The package implements multivariate convex nonparametric least squares (CNLS) using quadratic programming (QP) for additive error models, ensuring convexity and monotonicity constraints are satisfied.
- For multiplicative models, it applies logarithmic transformation to the output variable and estimates the log-transformed CNLS model, preserving convexity in the original input-output space.
- It supports both variable returns to scale (VRS) and constant returns to scale (CRS) in production and cost function estimation through configurable model parameters.
- The package integrates with high-performance solvers such as MOSEK and KNITRO, and allows remote execution via the NEOS Server for nonlinear programming (NLP) problems.
- It provides modular design with distinct components for data handling, model specification, parameter setting, and result display, enhancing reproducibility and usability.
- The implementation includes support for residual analysis, coefficient extraction, and model diagnostics, with outputs compatible with standard statistical and econometric workflows.
Experimental results
Research questions
- RQ1How can convex regression techniques be effectively implemented in a general-purpose programming language like Python to support frontier estimation in efficiency analysis?
- RQ2What are the computational and practical challenges in applying multivariate convex nonparametric least squares (CNLS) and StoNED to real-world datasets?
- RQ3To what extent can open-source Python packages like pyStoNED replace commercial tools such as GAMS and MATLAB in nonparametric frontier estimation?
- RQ4How do additive and multiplicative error structures in CNLS models affect the estimation of production and cost frontiers, and how can they be efficiently implemented?
- RQ5Can a unified, open-access software framework improve the accessibility and adoption of advanced nonparametric methods in empirical productivity and efficiency research?
Key findings
- pyStoNED successfully implements both additive and multiplicative CNLS models, enabling estimation of frontier functions with shape constraints using QP and NLP solvers.
- The package supports the estimation of cost and production functions under both VRS and CRS assumptions, with results consistent with those obtained using commercial software like GAMS and MATLAB.
- Estimated coefficients (e.g., α, β, ε) from pyStoNED show minor numerical differences compared to GAMS due to non-uniqueness in CNLS solutions, but remain statistically and economically meaningful.
- The integration with NEOS Server allows remote execution of NLP problems, enabling scalable computation for large datasets without local solver dependencies.
- The package provides a fully open-access alternative to proprietary tools, significantly lowering the barrier to entry for researchers and practitioners in efficiency analysis.
- The tutorial demonstrates end-to-end workflow—from data loading to model optimization and result display—showcasing the package’s usability and reproducibility in empirical applications.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.