Statistics - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Estimation : Statistics/MaximumLikelihoodEstimate

Statistics

 MaximumLikelihoodEstimate
 compute the maximum likelihood estimate

 Calling Sequence MaximumLikelihoodEstimate(R, V, options)

Parameters

 R - algebraic; a random variable or distribution V - name or rtable; data sample options - (optional) equation(s) of the form option=value where option is one of bounds, samplesize, params, ignore, output, or weights; specify options for the MaximumLikelihoodEstimate function

Description

 • The MaximumLikelihoodEstimate function computes the maximum likelihood estimate of a random variable R evaluated on a data set V.
 • The first parameter R can be a distribution (see Statistics[Distribution]), a random variable, or an algebraic expression involving random variables (see Statistics[RandomVariable]).
 • The second parameter V can be an Array of data samples or a symbol representing an Array of data samples (in which case the option samplesize must be specified).

Options

 The options argument can contain one or more of the options shown below.
 • samplesize = deduce or posint -- If set to 'deduce' (default) the function uses the number of data samples provided in V.  This parameter must be specified if the number of samples in V is not immediately detectable.
 • bounds = none or range or list(name = range) -- This option is only used when numeric solutions are computed. In this case, if the option specifies a range, then the function will attempt to calculate the maximum likelihood estimate such that all estimated parameters fall within the given bounds. If the option specifies a list of equations, then the left hand sides of these equations should be names of parameters to be estimated; the computed values will then fall within the right hand side bounds. The default range for each parameter is $-\mathrm{\infty }..\mathrm{\infty }$. It is highly recommended to specify finite ranges for all parameters when numeric solutions are required; Maple uses NLPSolve for the numeric case and it performs much better when given these ranges.
 For symbolic solutions, the bounds option is ignored. Maple uses solve for this case.
 • params = list(name=realcons) -- This option specifies parameters that should be evaluated prior to calculating the maximum likelihood estimate.
 • ignore = truefalse -- This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in data will be ignored.
 • output = equation or deduce or value -- If $\mathrm{output}=\mathrm{equation}$ is given, then every solution will be returned as a list of equations, one equation for each parameter to be estimated. If $\mathrm{output}=\mathrm{value}$ is supplied, which is only valid if there is only one parameter to be estimated, then every solution will be returned as just the value of that parameter. If $\mathrm{output}=\mathrm{deduce}$ is specified (the default), then Maple will act as $\mathrm{output}=\mathrm{equation}$ if there are multiple parameters to be estimated and as $\mathrm{output}=\mathrm{value}$ if there is only one. If there are multiple solutions, then they are returned in a sequence.
 • weights = rtable -- Vector of weights (one-dimensional rtable). If weights are given, the MaximumLikelihoodEstimate function will scale each data point to have given weight. Note that the weights provided must have type realcons and the results are floating-point, even if the problem is specified with exact values. Both the data array and the weights array must have the same number of elements.

Notes

 • Note that for numeric solutions this function uses NLPSolve which is not sensitive to assumptions made with the assume command.  For symbolic solutions this function uses solve instead and ignores the bounds option.

Examples

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

Calculate the maximum likelihood estimate of the probability parameter in the Binomial distribution for a general sample.

 > $\mathrm{MaximumLikelihoodEstimate}\left(\mathrm{Binomial}\left(10,\mathrm{θ}\right),A,\mathrm{samplesize}=4\right)$
 $\frac{{1}}{{40}}{}{{A}}_{{1}}{+}\frac{{1}}{{40}}{}{{A}}_{{2}}{+}\frac{{1}}{{40}}{}{{A}}_{{3}}{+}\frac{{1}}{{40}}{}{{A}}_{{4}}$ (1)

Perform the same calculation except with a specific sample.

 > $S≔\mathrm{Sample}\left(\mathrm{Binomial}\left(10,0.4\right),1000\right):$
 > $\mathrm{MaximumLikelihoodEstimate}\left(\mathrm{Binomial}\left(10,\mathrm{θ}\right),S,\mathrm{bounds}=0..1\right)$
 ${0.393199998195490}$ (2)

Compute the maximum likelihood estimate of the mean and standard deviation of a normal distribution. If there are multiple solutions, as in this example, they are returned as a sequence.

 > $\mathrm{MaximumLikelihoodEstimate}\left(\mathrm{Normal}\left(\mathrm{μ},\mathrm{σ}\right),A,\mathrm{samplesize}=2\right)$
 $\left[{\mathrm{μ}}{=}\frac{{1}}{{2}}{}{{A}}_{{1}}{+}\frac{{1}}{{2}}{}{{A}}_{{2}}{,}{\mathrm{σ}}{=}{-}\frac{{1}}{{2}}{}{{A}}_{{2}}{+}\frac{{1}}{{2}}{}{{A}}_{{1}}\right]{,}\left[{\mathrm{μ}}{=}\frac{{1}}{{2}}{}{{A}}_{{1}}{+}\frac{{1}}{{2}}{}{{A}}_{{2}}{,}{\mathrm{σ}}{=}\frac{{1}}{{2}}{}{{A}}_{{2}}{-}\frac{{1}}{{2}}{}{{A}}_{{1}}\right]$ (3)

The above example illustrates that the maximum likelihood estimate of $\mathrm{\sigma }$ is the population standard deviation, not the sample standard deviation. We show this for a concrete example below.

 > $S≔⟨-0.33,1.96,0.23,-3.37,0.79⟩$
 ${S}{≔}\left[\begin{array}{c}{-}{0.33}\\ {1.96}\\ {0.23}\\ {-}{3.37}\\ {0.79}\end{array}\right]$ (4)
 > $\mathrm{results}≔\mathrm{MaximumLikelihoodEstimate}\left(\mathrm{Normal}\left(\mathrm{μ},\mathrm{σ}\right),S,\mathrm{bounds}=\left[\mathrm{σ}=0..\mathrm{∞}\right]\right)$
 ${\mathrm{results}}{≔}\left[{\mathrm{μ}}{=}{-}{0.144000000000000}{,}{\mathrm{σ}}{=}{1.78217395335023}\right]$ (5)
 > $\mathrm{sampleStandardDeviation}≔\mathrm{StandardDeviation}\left(S\right)$
 ${\mathrm{sampleStandardDeviation}}{≔}{1.99253105371033}$ (6)
 > $\mathrm{eval}\left(\mathrm{σ},\mathrm{results}\right),\mathrm{evalf}\left(\mathrm{sampleStandardDeviation}\sqrt{\frac{4}{5}}\right)$
 ${1.78217395335023}{,}{1.78217395295189}$ (7)

Compatibility

 • The V parameter was updated in Maple 16.
 • The output option was introduced in Maple 16.
 • The bounds option was updated in Maple 16.