# Introduction:

When it comes to regression analysis, choosing the right approach is crucial for accurate predictions and meaningful insights. Two common methods used are parametric, like linear regression, and non-parametric, like K-nearest neighbors (KNN) regression. Each has its own advantages and disadvantages, and the choice between them largely depends on the nature of the data and the underlying relationships.

## Parametric Approach:

Linear Regression Linear regression is a well-known parametric method that assumes a linear functional form for the relationship between the predictors (X) and the target variable (Y). This approach has several benefits, such as ease of estimation with a small number of coefficients. In linear regression, these coefficients have straightforward interpretations, and statistical significance tests are readily applicable. However, parametric methods come with a significant limitation — they rely on the assumption that the specified functional form is a close approximation to the true relationship. If this assumption is far from reality, linear regression can perform poorly and yield unreliable results.

## Non-Parametric Approach:

K-Nearest Neighbors (KNN) Regression On the other hand, non-parametric methods like KNN regression do not make explicit assumptions about the functional form of the relationship between X and Y. Instead, they provide a more flexible approach for regression. KNN regression identifies the K training observations closest to a prediction point and estimates the target variable by averaging their values. While this approach is more versatile and can handle complex relationships, it can suffer from high variance when K is small, leading to overfitting. Conversely, when K is large, KNN regression can underfit the data.

## When Does Parametric Outperform Non-Parametric?

The key question is when to choose a parametric approach like linear regression over a non-parametric one such as KNN regression. The answer is straightforward: a parametric approach performs better when the chosen functional form is a close match to the true relationship, particularly in the presence of a linear relationship.

Illustrative Examples: To illustrate this point, let’s consider a few scenarios:

1. Linear Relationship: When the true relationship between X and Y is linear, linear regression outperforms KNN regression. Linear regression provides an almost perfect fit in this situation, as it closely matches the underlying relationship.

2. Slight Non-Linearity: In cases of slight non-linearity, where the true relationship deviates slightly from linearity, KNN regression can perform nearly as well as linear regression. It still provides reasonable results without a substantial reduction in prediction accuracy. Fig 1 : Plots of ˆf(X) using KNN regression on a two-dimensional data set with 64 observations (orange dots). Left: K = 1 results in a rough step function ft. Right: K = 9 produces a much smoother ft.

3. Strong Non-Linearity: However, in situations with a strong non-linear relationship, KNN regression outperforms linear regression. This is because KNN can adapt to complex relationships, providing more accurate predictions. Fig 2 : Plots of ˆf(X) using KNN regression on a one-dimensional data set with 50 observations. The true relationship is given by the black solid line. Left: The blue curve corresponds to K = 1 and interpolates (i.e. passes directly through) the training data. Right: The blue curve corresponds to K = 9, and represents a smoother ft. Fig 3 : The same data set shown in Figure 2 is investigated further. Left: The blue dashed line is the least squares ft to the data. Since f(X) is in fact linear (displayed as the black line), the least squares regression line provides a very good estimate of f(X). Right: The dashed horizontal line represents the least squares test set MSE, while the green solid line corresponds to the MSE for KNN as a function of 1/K (on the log scale). Linear regression achieves a lower test MSE than does KNN regression, since f(X) is in fact linear. For KNN regression, the best results occur with a very large value of K, corresponding to a small value of 1/K.

4. Curse of Dimensionality: When dealing with high-dimensional data, KNN regression may suffer from the “curse of dimensionality.” In such cases, the performance of KNN deteriorates significantly as the dimensionality of the data increases. Linear regression, with its fewer parameters, is less affected by this issue. Fig 4 : Test MSE for linear regression (black dashed lines) and KNN (green curves) as the number of variables p increases. The true function is nonlinear in the frst variable, as in the lower panel in Figure 3., and does not depend on the additional variables. The performance of linear regression deteriorates slowly in the presence of these additional noise variables, whereas KNN’s performance degrades much more quickly as p increases.

# Conclusion:

Choosing between parametric and non-parametric regression methods depends on the nature of the data and the true underlying relationship between predictors and the target variable. While non-parametric methods like KNN can be powerful when the relationship is complex or not well understood, linear regression often shines when the true relationship is linear or nearly linear. Additionally, linear regression offers the advantage of model interpretability and simplicity, which can be important for drawing meaningful conclusions. Ultimately, the selection of the right regression method should be guided by the specific characteristics of the data and the goals of the analysis.