|
Calling Sequence
|
|
PolynomialFit(d, X, Y, v, options)
PolynomialFit(d, XY, v, options)
|
|
Parameters
|
|
d
|
-
|
posint; degree of polynomial model function
|
X
|
-
|
Vector; values of independent variable
|
Y
|
-
|
Vector; values of dependent variable
|
XY
|
-
|
Matrix; values of independent and dependent variables
|
v
|
-
|
name; (optional) independent variable name
|
options
|
-
|
(optional) equation(s) of the form option=value where option is one of output, summarize, svdtolerance or weights; specify options for the PolynomialFit command
|
|
|
|
|
Description
|
|
•
|
The PolynomialFit command fits a univariate polynomial to data by minimizing the least-squares error. Consider a model polynomial of independent variable and a dependent variable . Given k data points, where each point is a pair of numerical values for , this command finds coefficients of such that the sum of the k residuals squared is minimized. The ith residual is the value at the ith data point.
|
•
|
The first parameter d is the degree of .
|
•
|
In the first calling sequence, the second parameter X is a Vector containing the k values of the independent variable , and the third parameter Y is a Vector containing the k values of the dependent variable . In the second calling sequence XY is a Matrix with two columns, where the first column corresponds to X and the second column to Y. For X, Y, and XY, one can also use lists or Arrays; for details, see the Input Forms help page.
|
•
|
By default, the PolynomialFit command returns a Vector of dimension containing the coefficients of the polynomial resulting in the best fit, ordered from lowest to highest degree. If the optional parameter v is provided, then a polynomial in this variable name is returned instead.
|
•
|
By default, either the least-squares polynomial or a Vector containing the parameter values is returned, depending on the input arguments. Additional results or a solution module that allows you to query for various settings and results can be obtained with the output option. For more information, see the Statistics/Regression/Solution help page.
|
•
|
Weights for the data points can be supplied through the weights option.
|
|
|
Options
|
|
|
The options argument can contain one or more of the options shown below. These options are described in more detail on the Statistics/Regression/Options help page.
|
•
|
output = name or string -- Specify the form of the solution. The output option can take as a value the name solutionmodule, or one of the following names (or a list of these names): AtkinsonTstatistic, confidenceintervals, CookDstatistic, degreesoffreedom, externallystandardizedresiduals, internallystandardizedresiduals, leastsquaresfunction, leverages, parametervalues, parametervector, residuals, residualmeansquare, residualstandarddeviation, residualsumofsquares, rsquared, rsquaredadjusted, standarderrors, tprobability, tvalue, variancecovariancematrix. For more information, see the Statistics/Regression/Solution help page.
|
•
|
summarize = identical( true, false, embed ) -- Display a summary of the regression model
|
•
|
svdtolerance = realcons(nonnegative) -- Set the tolerance that determines whether a singular-value decomposition is performed.
|
•
|
weights = Vector -- Provide weights for the data points.
|
|
|
Notes
|
|
•
|
The underlying computation is done in floating-point; therefore, all data points must have type realcons and all returned solutions are floating-point, even if the problem is specified with exact values. For more information about numeric computation in the Statistics package, see the Statistics/Computation help page.
|
•
|
The PolynomialFit command uses various methods implemented in a built-in library provided by the Numerical Algorithms Group (NAG). Normally, a method using QR decomposition is applied. If it is determined that the system does not have full rank, then a singular-value decomposition (SVD) is performed. The svdtolerance option allows you to specify when an SVD should be performed. See the Statistics/Regression/Options help page for additional details.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
Use the summarize=true option to return a summary of the regression:
>
|
|
Summary:
----------------
Model: 1.9600000+.16500000*v+.11071429*v^2
----------------
Coefficients:
Estimate Std. Error t-value P(>|t|)
Parameter 1 1.9600 1.1720 1.6724 0.1930
Parameter 2 0.1650 0.7667 0.2152 0.8434
Parameter 3 0.1107 0.1072 1.0325 0.3778
----------------
R-squared: 0.9252, Adjusted R-squared: 0.8753
| |
| (3) |
Use the output=solutionmodule option to see the full results.
>
|
|
| (4) |
| (5) |
|
|
Compatibility
|
|
•
|
The XY parameter was introduced in Maple 15.
|
•
|
The Statistics[PolynomialFit] command was updated in Maple 2016.
|
•
|
The summarize option was introduced in Maple 2016.
|
|
|
|