In statistics, multivariate adaptive regression splines (MARS) is a form of regression analysis introduced by Jerome H. Friedman in 1991. It is a non-parametric regression technique and can be seen as an extension of linear models that automatically models nonlinearities and interactions between variables. The term "MARS" is trademarked and licensed to Salford Systems. In order to avoid trademark infringements, many open-source implementations of MARS are called "Earth".
The basics This section introduces MARS using a few examples. We start with a set of data: a matrix of input variables x, and a vector of the observed responses y, with a response for each row in x. For example, the data could be:
Here there is only one independent variable, so the x matrix is just a single column. Given these measurements, we would like to build a model which predicts the expected y for a given x.
A linear model for the above data is y^=−37+5.1x The hat on the y^ indicates that y^ is estimated from the data. The figure on the right shows a plot of this function: a line giving the predicted y^ versus x, with the original values of y shown as red dots. The data at the extremes of x indicates that the relationship between y and x may be non-linear (look at the red dots relative to the regression line at low and high values of x). We thus turn to MARS to automatically build a model taking into account non-linearities. MARS software constructs a model from the given x and y as follows y^= 25+6.1max(0,x−13)−3.1max(0,13−x)
The figure on the right shows a plot of this function: the predicted y^ versus x, with the original values of y once again shown as red dots. The predicted response is now a better fit to the original y values. MARS has automatically produced a kink in the predicted y to take into account non-linearity. The kink is produced by hinge functions. The hinge functions are the expressions starting with max (where max(a,b) is a if a>b, else b). Hinge functions are described in more detail below. In this simple example, we can easily see from the plot that y has a non-linear relationship with x (and might perhaps guess that y varies with the square of x). However, in general there will be multiple independent variables, and the relationship between y and these variables will be unclear and not easily visible by plotting. We can use MARS to discover that non-linear relationship. An example MARS expression with multiple variables is ozone= 5.2+0.93max(0,temp−58)−0.64max(0,temp−68)−0.046max(0,234−ibt)−0.016max(0,wind−7)max(0,200−vis)
This expression models air pollution (the ozone level) as a function of the temperature and a few other variables. Note that the last term in the formula (on the last line) incorporates an interaction between wind and vis. The figure on the right plots the predicted ozone as wind and vis vary, with the other variables fixed at their median values. The figure shows that wind does not affect the ozone level unless visibility is low. We see that MARS can build quite flexible regression surfaces by combining hinge functions. To obtain the above expression, the MARS model building procedure automatically selects which variables to use (some variables are important, others not), the positions of the kinks in the hinge functions, and how the hinge functions are combined.
The MARS model MARS builds models of the form f^(x)=∑i=1kciBi(x). The model is a weighted sum of basis functions Bi(x). Each ci is a constant coefficient. For example, each line in the formula for ozone above is one basis function multiplied by its coefficient. Each basis function Bi(x) takes one of the following three forms:
a constant 1. There is just one such term, the intercept. In the ozone formula above, the intercept term is 5.2. a hinge function. A hinge function has the form max(0,x−constant) or max(0,constant−x). MARS automatically selects variables and values of those variables for knots of the hinge functions. Examples of such basis functions can be seen in the middle three lines of the ozone formula. a product of two or more hinge functions. These basis functions can model interaction between two or more variables. An example is the last line of the ozone formula.
Hinge functions
A key part of MARS models are hinge functions taking the form max(0,x−c) or max(0,c−x) where c is a constant, called the knot. The figure on the right shows a mirrored pair of hinge functions with a knot at 3.1. A hinge function is zero for part of its range, so can be used to partition the data into disjoint regions, each of which can be treated independently. Thus for example a mirrored pair of hinge functions in the expression 6.1max(0,x−13)−3.1max(0,13−x) creates the piecewise linear graph shown for the simple MARS model in the previous section. One might assume that only piecewise linear functions can be formed from hinge functions, but hinge functions can be multiplied together to form non-linear functions. Hinge functions are also called ramp, hockey stick, or rectifier functions. Instead of the max notation used in this article, hinge functions are often represented by [±(xi−c)]+ where [⋅]+ means take the positive part.
The model building process
MARS builds a model in two phases: the forward and the backward pass. This two-stage approach is the same as that used by recursive partitioning trees.
The forward pass MARS starts with a model which consists of just the intercept term (which is the mean of the response values). MARS then repeatedly adds basis function in pairs to the model. At each step it finds the pair of basis functions that gives the maximum reduction in sum-of-squares residual error (it is a greedy algorithm). The two basis functions in the pair are identical except that a different side of a mirrored hinge function is used for each function. Each new basis function consists of a term already in the model (which could perhaps be the intercept term) multiplied by a new hinge function. A hinge function is defined by a variable and a knot, so to add a new basis function, MARS must search over all combinations of the following:
… excerpt ends here. Continue reading the full article.



