# TruncatedDistribution

TruncatedDistribution[{xmin,xmax},dist]

represents the distribution obtained by truncating the values of dist to lie between xmin and xmax.

TruncatedDistribution[{{xmin,xmax},{ymin,ymax},},dist]

represents the distribution obtained by truncating the values of the multivariate distribution dist to lie between xmin and xmax, ymin and ymax, etc.

# Details • The probability density for TruncatedDistribution[{xmin,xmax},dist] is given by for , where is the PDF and is the CDF of dist, and is zero otherwise.
• Common cases for {xmin,xmax} include:
•  {-∞,xmax} truncated from above {xmin,∞} truncated from below {xmin,xmax} doubly truncated {-∞,∞},None no truncation
• TruncatedDistribution can be used with such functions as Mean, CDF, and RandomVariate.

# Examples

open allclose all

## Basic Examples(3)

Simple truncated distributions:

Define a truncated univariate distribution:

Define a truncated multivariate distribution:

## Scope(35)

### Basic Uses(9)

Define various truncations for a univariate continuous distribution:

The resulting PDF is 0 outside the truncation region:

Define various truncations for a univariate discrete distribution:

The left endpoint is not included, but the right endpoint is included:

Define a right-truncated distribution:

Compare PDFs:

Define a left-truncated distribution:

Compare probability density functions:

Compare means:

Compare standard deviations:

Define a doubly truncated distribution:

Compare means:

Compare variances:

Define a truncated multivariate continuous distribution:

Compute the expectation of an expression for this distribution:

Find a few moments:

Define a truncated multivariate discrete distribution:

Compare probabilities for a point outside the truncation region:

Generate a random sample:

Compare the means:

Define a truncated multivariate discrete distribution:

Compare skewness:

Compare kurtosis:

Estimate a truncation interval using EstimatedDistribution:

Fit a truncated normal:

### Parametric Distributions(7)

Define a left-truncated continuous distribution:

Compare the probability density functions:

Cumulative distribution function of the truncated exponential distribution:

Statistical measures:

Compare to the original distribution:

Define a right-truncated discrete distribution:

Compare the PDFs:

The truncated distribution is the same as the following:

Define a truncation of a UniformDistribution:

Probability density function:

Compare to the uniform distribution defined on the truncation interval:

Define a truncation of a DiscreteUniformDistribution:

Probability density function:

Compare to the uniform distribution defined on the truncation interval:

Truncation does not include the left endpoint, hence the resulting discrete distribution:

Define a truncated binormal distribution:

Compare the PDFs for the binormal distribution and the truncated version:

Probability density function of the truncated binormal:

Characteristic function:

Define a discrete multivariate truncated distribution:

Perform statistical operations on this distribution:

Generate a set of pseudorandom numbers from a truncated distribution:

Compare the histogram to the PDF:

### Nonparametric Distributions(3)

Truncate a SmoothKernelDistribution:

Compare probability density functions:

Define a truncated EmpiricalDistribution:

Compare cumulative distribution functions:

Define a truncated HistogramDistribution:

Probability density function:

### Derived Distributions(10)

Define a truncated TruncatedDistribution:

Find a probability density function:

Identify as a truncated distribution:

Define a truncated CopulaDistribution:

Define a truncated MixtureDistribution:

Compare probability density functions:

Define a truncated OrderDistribution:

Find the probability that the maximum of a Poisson sample is greater than 6, assuming it is greater than 5:

Find the probability that the maximum is greater than 6 without assuming it is greater than 5:

Define a truncated TransformedDistribution:

Compare with the transformation of the truncated normal:

Define a truncated ParameterMixtureDistribution:

Compare PDFs:

Find the probabilities of most-likely values for both distributions:

Define a truncated ProductDistribution:

Compare the probability density functions:

Compare with the PDF of the product of the truncated distributions:

Define a truncated MarginalDistribution:

Compare the probability density functions:

Define a truncated CensoredDistribution:

Compare the probability density functions:

Truncation of a QuantityDistribution evaluates to QuantityDistribution:

Find mean temperature:

### Automatic Simplifications(6)

#### Continuous Distributions(4)

GumbelDistribution truncated to a positive axis follows a GompertzMakehamDistribution:

NormalDistribution truncated to a positive axis follows a HalfNormalDistribution:

ParetoDistribution is closed under truncation:

UniformDistribution is closed under truncation:

#### Discrete Distributions(2)

DiscreteUniformDistribution is closed under truncation:

ZipfDistribution is closed under truncation:

## Applications(5)

A grocery store orders pounds of produce for price per pound to be sold during the day. It sells the produce with margin per pound. The amount of produce sold in a day follows some distribution . The unsold produce is discarded at the end of the day. Compute so that it maximizes the daily profit:

Assuming 30% margin, and using LogNormalDistribution for distribution of demand:

The diameter of an American cranberry follows a normal distribution with mean 16 mm and standard deviation 1.6 mm. A fruit must be at least 15 mm across to be sold as whole; otherwise, it is used in the production of cranberry sauce. Find the size distribution of the fruits being sold as whole:

Compare probability density functions:

Find the average diameter of sold fruits:

The probability that a sold fruit is at least 18 mm in diameter:

Truncated distribution can be used to control display of long tail distributions. Consider a sample:

Fit a Pareto distribution to the data:

Compare the histogram of the sample with the PDF of the estimated distribution:

Due to the long tail, the histogram range has to be adjusted and the distribution truncated:

Consider the width of certain species of crab:

Fit a DagumDistribution to the data:

Compare the histogram to the PDF of the estimated distribution:

Usually the dimensions of the caught crab species fall in a certain range:

Fit left-truncated Dagum distribution to the data:

Compare log-likelihood values to see if the fit with a truncated distribution is better:

A company manufactures nails with length normally distributed and a mean of 0.5 inches. Given that the length of 50% of the produced nails differs less than 0.05 inches from the mean, find the standard deviation:

The standard deviation is found by requiring the probability of being within specs to equal 50%:

Plot to find the approximate value:

The standard deviation:

## Properties & Relations(6)

Truncating a distribution is equivalent to conditioning on an interval:

The PDF of a truncated distribution has nonzero values only inside the truncation interval:

Compare the density functions:

Construct the PDF of a truncated distribution by using properties of the underlying distribution:

Compare censoring with truncating for a discrete distribution:

While truncating, the weight from outside is evenly distributed over the truncation interval:

While censoring, the weight from outside is placed at the ends of the censoring interval:

Compare censoring and truncating of a continuous distribution:

While truncating, the probability is distributed over the truncation interval:

While censoring, the probability is put at the end of the censoring interval:

GompertzMakehamDistribution is related to a truncated WeibullDistribution:

## Neat Examples(1)

Double truncation of a bivariate distribution: