# NxLOCREG - Local or moving polynomial regression

Calculates the local/moving non-parametric regression (i.e. LOESS, LOWESS, etc.) forecast.

## Syntax

NxLOCREG(X, YPKernel, Alpha, Optimize,Target, Return)

X is the x-component of the input data table (a one dimensional array of cells (e.g. rows or columns)).

Y is the y-component (i.e. function) of the input data table (a one dimensional array of cells (e.g. rows or columns)).

P is the polynomial order (0 = constant, 1= linear, 2=Quadratic, 3=Cubic, etc.), etc.). If missing, P = 0.

Kernel is the weighting kernel function used with KNN-Regression method : 0(or missing)=Uniform, 1=Triangular, 2=Epanechnikov, 3=Quartic, 4=Triweight, 5=Tricube, 6=Gaussian, 7=Cosine, 8=Logistic, 9= Sigmoid, 10= Silverman.

Value Kernel
0 Uniform Kernel (default)
1 Triangular Kernel
2 Epanechnikov Kernel
3 Quartic Kernel
4 Triweight Kernel
5 Tricube Kernel
6 Gaussian Kernel
7 Cosine Kernel
8 Logistic Kernel
9 Sigmoid Kernel
10 Silverman Kernel

Alpha is the fraction of the total number (n) of data points that are used in each local fit (between 0 and 1). If missing or omitted, Alpha = 0.333.

Optimize is a flag (True/False) for searching and using optimal integer value K (i.e. number of data-points). If missing or omitted, optimize is assumed False.

target is the desired x-value(s) to interpolate for (a single value or a one dimensional array of cells (e.g. rows or columns)).

Return is a number that determines the type of return value: 0=Forecast (default), 1=errors, 2=Smoothing parameter (bandwidth), 3=RMSE (CV). If missing or omitted, NxREG returns forecast/regression value(s).

Return Description
0 Forecast/Regression value(s) (default)
1 Forecast/Regression error(s)
3 RMSE (cross-validation)

## Remarks

1. Local regression is a non-parametric regression methods that combine multiple regression models in a k-nearest-neighbor-based meta-model.
2. Local regression or local polynomial regression, also known as moving regression, is a generalization of moving average and polynomial regression.
3. Its most common methods, initially developed for scatterplot smoothing, are LOESS (locally estimated scatterplot smoothing) and LOWESS (locally weighted scatterplot smoothing).
4. Outside econometrics, LOESS is known and commonly referred to as Savitzky–Golay filter.Savitzky–Golay filter was proposed 15 years before LOESS.
5. $\alpha$ is called the smoothing parameter because it controls the flexibility of the LOESS regression function. Large values of $\alpha$ produce the smoothest functions that wiggle the least in response to fluctuations in the data. The smaller $\alpha$ is, the closer the regression function will conform to the data. Using too small a value of the smoothing parameter is not desirable, however, since the regression function will eventually start to capture the random error in the data.
6. The number of rows of the response variable (Y) must be equal to the number of rows of the explanatory variable (X).
7. Observations (i.e. rows) with missing values in X or Y are removed.
8. NxLOCREG is very releated to NxKREG, but NxLOCRTEG uses nearest K-NN points to calculate kernel bandwidth and conduct its local regression.
9. The time series may include missing values (e.g. #N/A) at either end.
10. The NxLOCREG() function is available starting with version 1.66 PARSON.

## References

• Pagan, A.; Ullah, A. (1999). Nonparametric Econometrics. Cambridge University Press. ISBN 0-521-35564-8.
• Simonoff, Jeffrey S. (1996). Smoothing Methods in Statistics. Springer. ISBN 0-387-94716-7.
• Li, Qi; Racine, Jeffrey S. (2007). Nonparametric Econometrics: Theory and Practice. Princeton University Press. ISBN 0-691-12161-3.
• Henderson, Daniel J.; Parmeter, Christopher F. (2015). Applied Nonparametric Econometrics. Cambridge University Press. ISBN 978-1-107-01025-3.