Documentation Center

  • Trial Software
  • Product Updates

negloglik

Class: prob.ToolboxFittableParametricDistribution
Package: prob

Negative loglikelihood of probability distribution object

Syntax


nll = negloglik(pd)

Description

nll = negloglik(pd) returns the value of the negative loglikelihood function for the data used to fit the probability distribution pd.

Input Arguments

expand all

pd — Probability distributionprobability distribution object

Probability distribution, specified as a probability distribution object. Create a probability distribution object with specified parameter values using makedist. Alternatively, create a probability distribution object by fitting it to data using fitdist or the Distribution Fitting app.

Output Arguments

expand all

nll — Negative log likelihoodscalar value

Negative log likelihood value for the data used to fit the distribution, returned as a scalar value.

Examples

expand all

Negative Log Likelihood for a Fitted Distribution

Load the sample data.

load carsmall;

Create a Weibull distribution object by fitting it to the mile per gallon (MPG) data.

pd = fitdist(MPG,'Weibull')
pd = 

  WeibullDistribution

  Weibull distribution
    A = 26.5079   [24.8333, 28.2954]
    B = 3.27193   [2.79441, 3.83104]

Compute the negative log likelihood for the fitted Weibull distribution.

wnll = negloglik(pd)
wnll =

  327.4942

See Also

| |

Was this topic helpful?