Regress

As of Version 7.0, has been superseded by LinearModelFit.


finds a least-squares fit to a list of data as a linear combination of the functions funs of variables vars.

DetailsDetails

  • To use , you first need to load the Linear Regression Package using .
  • The data can have the form , where the number of coordinates is equal to the number of variables in the list vars.
  • The data can also be of the form , with a single coordinate assumed to take values .
  • The argument funs can be any list of functions that depend only on the variables vars.
  • returns a list of rules for results and diagnostics specified by the option RegressionReport.
  • always finds the linear combination of the functions in the list funs that minimize the sum of the squares of deviations from the values .
  • Exact numbers given as input to are converted to approximate numbers with machine precision.
  • The following options can be given:
  • RegressionReportSummaryReportresults to be included in output
    IncludeConstantTruewhether to automatically include a constant as one of the functions
    BasisNamesAutomaticnames of basis elements for table headings
    WeightsAutomaticweights for each data point
    MethodAutomaticmethod used to compute singular values
    ToleranceAutomatictolerance to use in computing singular values
    ConfidenceLevel0.95confidence level used for confidence intervals
  • With the option IncludeConstant->False, gives the same fit as Fit does.
  • Possible settings for Weights are Automatic, a list of numbers with the same length as the data, or a pure function.
  • With the default setting Weights->Automatic, each data point is given a weight of 1.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

In[1]:=
Click for copyable input

Linear regression for a straight line:

In[2]:=
Click for copyable input
Out[2]=
In[1]:=
Click for copyable input

Linear regression for a constant plus a sinusoid:

In[2]:=
Click for copyable input
Out[2]=
New to Mathematica? Find your learning path »
Have a question? Ask support »