Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

gamlike - Gamma negative log-likelihood

Syntax

nlogL = gamlike(params,data)
[nlogL,AVAR] = gamlike(params,data)

Description

nlogL = gamlike(params,data) returns the negative of the gamma log-likelihood of the parameters, params, given data. params(1)=A, shape parameters, and params(2)=B, scale parameters.

[nlogL,AVAR] = gamlike(params,data) also returns AVAR, which is the asymptotic variance-covariance matrix of the parameter estimates when the values in params are the maximum likelihood estimates. AVAR is the inverse of Fisher's information matrix. The diagonal elements of AVAR are the asymptotic variances of their respective parameters.

[...] = gamlike(params,data,censoring) accepts a Boolean vector of the same size as data that is 1 for observations that are right-censored and 0 for observations that are observed exactly.

[...] = gamfit(params,data,censoring,freq) accepts a frequency vector of the same size as data. freq typically contains integer frequencies for the corresponding elements in data, but may contain any non-negative values.

gamlike is a utility function for maximum likelihood estimation of the gamma distribution. Since gamlike returns the negative gamma log-likelihood function, minimizing gamlike using fminsearch is the same as maximizing the likelihood.

Examples

Compute the negative log-likelihood of parameter estimates computed by the gamfit function:

a = 2; b = 3;
r = gamrnd(a,b,100,1);

[nlogL,AVAR] = gamlike(gamfit(r),r)
nlogL =
  267.5648
AVAR =
  0.0788  -0.1104
 -0.1104  0.1955

See Also

gamfit, gampdf, gamcdf, gaminv, gamstat, gamrnd

Gamma Distribution

  


Recommended Products

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