Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

negloglik

Class: prob.KernelDistribution
Package: prob

Negative loglikelihood

Syntax

nll = negloglik(pd)

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

Probability distribution, specified as a probability distribution object. Fit a probability distribution object to data using fitdist or the Distribution Fitter app.

Output Arguments

expand all

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

Examples

expand all

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

Was this topic helpful?