How to | Work with Statistical Distributions
Statistical distributions have applications in many fields, including the biological, social, and physical sciences. The Wolfram Language represents statistical distributions as symbolic objects. You can obtain properties, results, and random numbers for hundreds of built-in or custom distributions by applying built‐in functions to the objects.
You can use the PDF function to get the probability density function for the distribution:
You can also compute more general expected values, which give the value expected for a given function applied to a random variable from a given distribution. The raw moment is the expected value of raised to the power.
You can generate random numbers from distributions using RandomVariate.
You can use Histogram to generate a histogram of these values on a probability density scale:
You can visualize the theoretical density function using Plot:
You can then use Show to display the two graphics together:
You might also want to estimate parameter values assuming a dataset follows a particular distribution. For instance, you could find the maximum likelihood estimate for parameters by using FindDistributionParameters:
The results can be packaged up into a distribution object using EstimatedDistribution:
The log‐likelihood could also be computed using LogLikelihood with the estimated distribution:
The log‐likelihood value is mostly relevant compared to log‐likelihood values for other parameters. Creating a ContourPlot near the obtained values can provide a qualitative comparison. Points on a given contour have the same log‐likelihood.