| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
ACOV = mlecov(params,data,...)
ACOV = mlecov(params,data,'pdf',pdf,'cdf',cdf)
ACOV = mlecov(params,data,'logpdf',logpdf,'logsf',logsf)
ACOV = mlecov(params,data,'nloglf',nloglf)
[...] = mlecov(params,data,...,param1,val1,param2,val2,...)
ACOV = mlecov(params,data,...) returns an approximation to the asymptotic covariance matrix of the maximum likelihood estimators of the parameters for a specified distribution. The following paragraphs describe how to specify the distribution. mlecov computes a finite difference approximation to the Hessian of the log-likelihood at the maximum likelihood estimates params, given the observed data, and returns the negative inverse of that Hessian. ACOV is a p-by-p matrix, where p is the number of elements in params.
You must specify a distribution after the input argument data, as follows.
ACOV = mlecov(params,data,'pdf',pdf,'cdf',cdf) enables you to define a distribution by its probability density and cumulative distribution functions, pdf and cdf, respectively. pdf and cdf are function handles that you create using the @ sign. They accept a vector of data and one or more individual distribution parameters as inputs and return vectors of probability density function values and cumulative distribution values, respectively. If the 'censoring' name/value pair (see below) is not present, you can omit the 'cdf' name/value pair.
ACOV = mlecov(params,data,'logpdf',logpdf,'logsf',logsf) enables you to define a distribution by its log probability density and log survival functions, logpdf and logsf, respectively. logpdf and logsf are function handles that you create using the @ sign. They accept as inputs a vector of data and one or more individual distribution parameters, and return vectors of logged probability density values and logged survival function values, respectively. If the 'censoring' name/value pair (see below) is not present, you can omit the 'logsf' name/value pair.
ACOV = mlecov(params,data,'nloglf',nloglf) enables you to define a distribution by its log-likelihood function. nloglf is a function handle, specified using the @ sign, that accepts the following four input arguments:
params — Vector of distribution parameter values
data — Vector of data
cens — Boolean vector of censoring values
freq — Vector of integer data frequencies
nloglf must accept all four arguments even if you do not supply the 'censoring' or 'frequency' name/value pairs (see below). However, nloglf can safely ignore its cens and freq arguments in that case. nloglf returns a scalar negative log-likelihood value and, optionally, the negative log-likelihood gradient vector (see the 'gradient' name/value pair below).
pdf, cdf, logpdf, logsf, and nloglf can also be cell arrays whose first element is a function handle, as defined above, and whose remaining elements are additional arguments to the function. The mle function places these arguments at the end of the argument list in the function call.
[...] = mlecov(params,data,...,param1,val1,param2,val2,...) specifies optional parameter name/value pairs chosen from the following table.
| Parameter | Value |
|---|---|
| 'censoring' | Boolean vector of the same size as data, containing 1's when the corresponding elements of data are right-censored observations and 0's when the corresponding elements are exact observations. The default is that all observations are observed exactly. Censoring is not supported for all distributions. |
| 'frequency' | A vector of the same size as data containing nonnegative frequencies for the corresponding elements in data. The default is one observation per element of data. |
| 'options' | A structure opts containing numerical options for the finite difference Hessian calculation. You create opts by calling statset. The applicable statset parameters are:
|
Create the following M-file function:
function logpdf = betalogpdf(x,a,b) logpdf = (a-1)*log(x)+(b-1)*log(1-x)-betaln(a,b);
Fit a beta distribution to some simulated data, and compute the approximate covariance matrix of the parameter estimates:
x = betarnd(1.23,3.45,25,1); phat = mle(x,'dist','beta') acov = mlecov(phat,x,'logpdf',@betalogpdf)
![]() | mle | mnpdf | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |