Documentation Center

  • Trial Software
  • Product Updates

Contents

negloglik

Class: prob.KernelDistribution
Package: prob

Negative loglikelihood

Syntax

Description

example

nll = negloglik(pd) returns the value of the negative log likelihood 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. Fit a probability distribution object 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 Loglikelihood for a Kernel Distribution

Load the sample data. Fit a kernel distribution to the miles per gallon (MPG) data.

load carsmall;
pd = fitdist(MPG,'Kernel')
pd = 

  KernelDistribution

    Kernel = normal
    Bandwidth = 4.11428
    Support = unbounded

Compute the negative loglikelihood.

nll = negloglik(pd)
nll =

  327.3139

See Also

|

Was this topic helpful?