 Statistics - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Regression : Statistics/PowerFit

Statistics

 PowerFit
 fit a power function to data

 Calling Sequence PowerFit(X, Y, v, options) PowerFit(XY, v, options)

Parameters

 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 PowerFit command

Description

 • The PowerFit command fits a function of the form $y=a{x}^{b}$ to data by performing a least-squares fit using the transformed model function $\mathrm{ln}\left(y\right)={a}_{0}+b\mathrm{ln}\left(x\right)$, where ${a}_{0}$ is $\mathrm{ln}\left(a\right)$.  The new function is linear in the model parameters, ${a}_{0}$ and $b$.  Given k data points, where each point is a pair of numerical values for $\left[x,y\right]$, the PowerFit command finds ${a}_{0}$ and $b$ such that the sum of the k residuals squared is minimized.  The ith residual is the value $\mathrm{ln}\left(y\right)-{a}_{0}-b\mathrm{ln}\left(x\right)$ at the ith data point.
 • In the first calling sequence, the first parameter X is a Vector containing the k values of the independent variable x, and the second parameter Y is a Vector containing the k values of the dependent variable y.  The entries of X and Y must evaluate to positive numbers. In the second calling sequence, the first parameter 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.
 • If the third parameter v is provided, then the PowerFit command returns the model function in variable v with the computed values of $a$ and $b$.  Otherwise, a Vector containing values of $a$ and $b$ is returned.
 • The PowerFit command calls the Statistics[LinearFit] command to fit the given data to the linearized model.  Additional options accepted by the LinearFit command, such as weights=W where W is a Vector of weights,  may be provided to PowerFit. However, it is important to note that these options, including the output option for obtaining additional results, apply to the transformed model.  More information about the underlying linear regression solver is available on the LinearFit help page.

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.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$

Fit a power function to the provided data.

 > $X≔\mathrm{Vector}\left(\left[1,2,3,4,5,6\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $Y≔\mathrm{Vector}\left(\left[2,5.6,8.2,20.5,40.0,95.0\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{PowerFit}\left(X,Y,v\right)$
 ${1.47957778799590}{}{{v}}^{{2.04167436679388}}$ (1)

Return a summary of the regression:

 > $\mathrm{ls}≔\mathrm{PowerFit}\left(X,Y,v,\mathrm{summarize}=\mathrm{true}\right):$
 Summary: ---------------- Model: 1.4795778*v^2.04167436679388 ---------------- Coefficients:               Estimate  Std. Error  t-value  P(>|t|) Parameter 1    0.3918    0.3470      1.1290   0.3220 Parameter 2    2.0417    0.2771      7.3684   0.0018 ---------------- R-squared: 0.9869, Adjusted R-squared: 0.9803
 > $\mathrm{ls}$
 ${1.47957778799590}{}{{v}}^{{2.04167436679388}}$ (2)

Use the weights option to assign a weight to each data point.  Because the v parameter is not provided, a Vector containing the computed model parameters is returned.

 > $W≔\mathrm{Vector}\left(\left[1,1,1,2,5,5\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{PowerFit}\left(X,Y,\mathrm{weights}=W\right)$
 $\left[\begin{array}{c}{1.24188729404393}\\ {2.24962642912626}\end{array}\right]$ (3)

Compatibility

 • The XY parameter was introduced in Maple 15.