Polynomial Regression
A polynomial function : This approach is known as polynomial regression. Generally speaking, it is unusual to use greater than 3 or 4 because for large values of , the polynomial curve can become overly flexible and can take on some very strange shapes. This is especially true near the boundary of the variable.
We actually not really interested in the coefficient; more interested in the fitted function values at any value .
Since is a linear function of the , can get a simple expression for pointwise-variances at any value . In the figure we have computed the fit and pointwise standard errors on a gride of values for . We show .
Logistic regression follows naturally. For example, in figure we model: To get confidence intervals, compute upper and lowest bounds on the logit scale, and then invert to get on probability scale.
Step Functions
Using polynomial functions of the features as predictors in a linear model imposes a global structure on the non-linear function of (将特征的多项式函数作为线性模型中的预测因子,对X的非线性函数施加全局结构). We can instead use step functions in order to avoid imposing such a global structure.
Here, we break the range of into bins, and fit a different constant in each bin. This amounts to converting a continous variable into an ordered categorical variable.(这相当于将连续的变量转换为有序的分类变量). Where is an indicator function that returns a 1 if the condition is true, and returns a 0 otherwise.
We then use least squares to fit a linear model using as predictors: For a given value of , at most one of can be non-zero.
Unfortunately, unless there are natural breakpoints int the predictors, piecewise-constant functions can miss the action. Nevertheless, step function approaches are very popular in biostatistics and epidemiology, among other disciplines.
Basis Functions
Polynomial and piecewise-constant regression models are in fact special cases of a basis function approach. The idea is to have at hand a family of functions or transformations that can be applied to a variable : . Note that the basis function are fixed and known.
Hence, we can use least squares to estimate the unknown regression coefficients, and this means that all o f the inference tools for linear models that are discussed in Chapter 3 are available in this setting.
We can use wavelets or Fourier series to construct basis functions. In the next section, we investigate a very common choice for a basis function: regression splines.