negloglik
Negative loglikelihood of probability distribution
Syntax
Description
Examples
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
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
Input Arguments
pd
— Probability distribution
probability distribution object
Probability distribution, specified as one of the following probability distribution
objects created by fitdist
or Distribution Fitter:
Output Arguments
nll
— Negative loglikelihood
numeric value
Negative loglikelihood value for the data used to fit the distribution, returned as a numeric value.
Extended Capabilities
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2013a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)