Example of a multilinear regression : assume that dependent data yi (i=1,...,N) depend linearly on two independent variables x1i, x2i

<<"LinearRegression`"

The "Fit" function, when given a list of linear functions {1, x1, x2} and a list of variables {x1, x2}, performs a multi - linear regression on the data points:

Fit[{{0,0.30,10.14},{0.69,0.60,11.93},{1.10,0.90,13.57},{1.39,1.20,14.17},{1.61,1.50,15.25},{1.79,1.80,16.15}},{1,x1,x2},{x1,x2}]

The "Regress" function does the same, providing more details :

mlreg1=Regress[{{0,0.30,10.14},{0.69,0.60,11.93},{1.10,0.90,13.57},{1.39,1.20,14.17},{1.61,1.50,15.25},{1.79,1.80,16.15}},{1,x1,x2},{x1,x2},RegressionReport->{BestFit,ParameterCITable}]

The SummaryReport provides additional information :

Regress[{{0,0.30,10.14},{0.69,0.60,11.93},{1.10,0.90,13.57},{1.39,1.20,14.17},{1.61,1.50,15.25},{1.79,1.80,16.15}},{1,x1,x2},{x1,x2},RegressionReport->{SummaryReport}]

RSquared (coefficient of determination) is the ratio of the model sum of squares to the total sum of squares.

EstimatedVariance is equivalent to the squared sum of FitResiduals divided by the degrees of freedom n-p where n is the length of the data set and p is the number of parameters.

ANOVATable, a table for analysis of variance,provides a comparison of the given model to a smaller one including only a constant term. If IncludeConstant->False is specified, then the smaller model is reduced to the data. The table includes the degrees of freedom, the sum of squares and the mean squares due to the model (in the row labeled Model) and due to the residuals (in the row labeled Error). The residual mean square is also available in EstimatedVariance, and is calculated by dividing the residual sum of squares by its degrees of freedom. The F-test compares the two models using the ratio of their mean squares. If the value of F is large, the null hypothesis supporting the smaller model is rejected.

Let' s compare the best fit function with the data :

data={{0,0.30,10.14},{0.69,0.60,11.93},{1.10,0.90,13.57},{1.39,1.20,14.17},{1.61,1.50,15.25},{1.79,1.80,16.15}}

graph1=ListPointPlot3D[data,PlotStyle->Directive[PointSize[Large],Red],Filling->Bottom]

graph2=Plot3D[(BestFit /. mlreg1),{x1,0,2},{x2,0,2},ColorFunction->"DarkRainbow",PlotStyle->Directive[Opacity[0.4]],Mesh->None]

Show[graph1,graph2,AxesLabel->{x1,x2},PlotLabel->y]