Logarithmic Fit - Maple Help

Statistics

 LogarithmicFit
 fit a logarithmic function to data

 Calling Sequence LogarithmicFit(X, Y, v, options) LogarithmicFit(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 or weights; specify options for the LogarithmicFit command

Description

 • The LogarithmicFit command fits a logarithmic function of the form $y=a+b\mathrm{ln}\left(x\right)$ to data by performing a least-squares fit.  Given k data points, where each point is a pair of numerical values for ($x$, $y$), the LogarithmicFit command finds a and b such that the sum of the k residuals squared is minimized.  The ith residual is the value $y-a-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 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 optional parameter v is provided, then the LogarithmicFit command returns the logarithmic function in variable v with the computed values of a and b.  Otherwise, a Vector containing values of a and b is returned.
 • The LogarithmicFit command calls the Statistics[LinearFit] command to fit the given data to the model.  Additional options accepted by the LinearFit command, such as weights=W where W is a Vector of weights, may be provided to LogarithmicFit. 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 logarithmic function to the provided data.

 > $X≔\mathrm{Vector}\left(\left[10,30,60,100,200,352\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $Y≔\mathrm{Vector}\left(\left[18.4,26.1,31.0,34.5,39.4,43.3\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{LogarithmicFit}\left(X,Y,v\right)$
 ${2.30938538792688}{+}{6.99557865847690}{}{\mathrm{ln}}{}\left({v}\right)$ (1)

Use the summarize option to return a summary of the regression:

 > $\mathrm{ls}≔\mathrm{LogarithmicFit}\left(X,Y,v,\mathrm{summarize}=\mathrm{embed}\right):$

Model:

${2.3093854}{+}{6.9955787}{}{\mathrm{ln}}{}\left({v}\right)$

 Coefficients Estimate Standard Error t-value P(>|t|) Parameter 1 ${2.30939}$ ${0.0528264}$ ${43.7165}$ ${\mathbf{1.63703}}{\mathbf{×}}{{\mathbf{10}}}^{{\mathbf{-6}}}$ Parameter 2 ${6.99558}$ ${0.0119477}$ ${585.515}$ ${\mathbf{5.10494}}{\mathbf{×}}{{\mathbf{10}}}^{{\mathbf{-11}}}$

R-squared:

${0.999988}$

${0.999985}$

Residuals

 Residual Sum of Squares Residual Mean Square Residual Standard Error Degrees of Freedom ${0.00477655}$ ${0.00119414}$ ${0.0345563}$ ${4}$

Five Point Summary

 Minimum First Quartile Median Third Quartile Maximum ${-0.0288785}$ ${-0.0255209}$ ${-0.0100149}$ ${0.0276926}$ ${0.0483052}$

 > $\mathrm{ls}$
 ${2.30938538792688}{+}{6.99557865847690}{}{\mathrm{ln}}{}\left({v}\right)$ (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,2,1,1,1,3\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{LogarithmicFit}\left(X,Y,\mathrm{weights}=W\right)$
 $\left[\begin{array}{c}2.3273639914554045\\ 6.9901160534958935\end{array}\right]$ (3)
 > 

Compatibility

 • The XY parameter was introduced in Maple 15.