QuantityDistribution

QuantityDistribution[dist,unit]

represents a distribution dist of quantities with unit specified by unit.

QuantityDistribution[dist,{unit1,unit2,}]

represents a multivariate distribution with units {unit1,unit2,}.

Details

Examples

open allclose all

Basic Examples  (3)

Define a distribution for a random position:

Compute the probability of the position exceeding a threshold:

Define a distribution of life expectancy:

Compute conditional life expectancy:

Fit a model to data with units:

Convert the distribution to another compatible unit:

Compare with fitting to distribution in hours:

Scope  (29)

Basic Uses  (11)

Find the mean time of service for a device with WeibullDistribution-modeled lifetime:

Find the median time of service:

Compute the cumulative distribution function for a quantity distribution:

The argument of CDF is assumed to be a quantity of time:

Evaluate the cumulative distribution function for a few time values:

Find the cumulative distribution function for the argument in minutes:

Compute quantile of a QuantityDistribution:

Sampling from QuantityDistribution gives Quantity or QuantityArray:

Sample 238 insurance claim sizes according to the chosen model:

Compute log-likelihood for distribution with quantities on data with quantities:

Data can have any compatible units:

PDF for continuous distribution with quantities:

The probability density function has a reciprocal unit:

This is consistent with substituting quantities into the symbolic expression for PDF:

The PDF for discrete distribution with quantities is unitless:

The HazardFunction for continuous distributions with quantities has reciprocal units:

Estimate the distribution of solar radiant energy reaching Earth's surface from synthetic data:

Compare the fit:

QuantityMagnitude and QuantityUnit of a quantity distribution:

Extract the distribution of the magnitude:

Extract the unit:

Use UnitConvert to convert distribution to compatible units:

Distribution of voltage with random resistance and current:

Use UnitSimplify to simplify units to "Volts":

Construction  (6)

Define distribution for a quantity of length:

Define the same distribution using a quantity scale parameter:

Find its median:

Define joint distribution of height and weight:

Define the same distribution using quantity parameters:

Convert the distribution into different units:

Parsing of unknown unit strings is automatically attempted:

Find the interpreted unit:

Quantities can be used to specify units in QuantityDistribution:

Magnitude of the input quantity is ignored:

Use TransformedDistribution to define distribution of random quantities:

Compute the mean distance:

Define data distribution with units:

Plot the cumulative distribution function:

Estimation  (4)

Estimate distribution from quantity data:

Fit a normal distribution in meters to the data:

Fit a normal distribution in feet to the data:

Estimate parameters of a multivariate distribution:

Fit a multivariate distribution in the units of the data:

Fit a multivariate distribution in compatible units:

Estimate distribution from the quantity data:

The data is bimodal, suggesting a mixture of bivariate normal distributions might be a good fit:

EstimatedDistribution gives QuantityDistribution with fitted parameters:

FindDistributionParameters gives rules with Quantity values when possible:

Substituting these parameters into the model results in QuantityDistribution:

Estimate distribution from quantity data:

Specify starting values of relevant parameters using quantities:

Parameters of magnitude distribution dist in QuantityDistribution[dist,units] are numeric:

Derived Distributions  (8)

Truncate a quantity distribution:

Truncation of QuantityDistribution gives another QuantityDistribution:

Censor a quantity distribution:

Censoring of QuantityDistribution gives another QuantityDistribution:

Compute the mean of the censored quantity distribution:

Define mixture of quantity distributions:

Mixture of compatible QuantityDistributions gives another QuantityDistribution:

Define a spliced distribution with quantity distributions:

Splicing several QuantityDistributions gives another QuantityDistribution:

Sample from the spliced distribution and visualize the histogram:

ProductDistribution of quantity distributions:

Product distribution evaluates to QuantityDistribution:

Evaluate moment:

Create a parameter mixture with quantity distribution:

Parameter mixture of QuantityDistribution evaluates to QuantityDistribution:

Define distribution of the maximum of random quantities:

The distribution of the order statistics gives QuantityDistribution:

QuantityDistribution of a QuantityDistribution:

The result is consistent with the behavior of Quantity under composition:

For a data distribution:

Applications  (8)

The average speed of cars traveling from Champaign, Illinois, to Chicago, Illinois, is well described as a triangular random variable:

Find the expected time of travel:

Define the distribution of a cube's side-length measurements:

Plot the distribution density:

Compute the mean and the dispersion measures of the cube's volume:

Plot the PDF of the cube's volume:

Recorded body weights in kilograms:

Plot the histogram of the data:

Fit NormalDistribution to the data:

Compare the histogram with the estimated PDF:

Express the estimated distribution in pounds:

Test data normality:

The waiting time a customer spends in a restaurant is believed to be exponentially distributed with an average wait time of 5 minutes:

Find the probability that the customer will have to wait more than 10 minutes:

The lifetime of a component has WeibullDistribution with shape and scale parameters of 2 and 997.5 hours, respectively. Find the probability that the component survives 300 hours:

Find the probability that the component is still working after 500 hours, given that it has survived 300 hours:

Find the mean time to failure:

Estimate the distribution of the daily mean temperature in Chicago in the summer of 2015:

Fit the distribution to PERTDistribution:

Check goodness of fit:

Find the estimated distribution for temperature in degrees Fahrenheit:

Velocity density function along any direction of a gas molecule follows a normal distribution with mean 0 and standard deviation . The standard deviation for molecular hydrogen at 573 K is:

The distribution of the speeds of molecules in a hydrogen gas at 573 K is given:

Find the probability that a hydrogen molecule has speed at least 4000 meters per second:

Find the average speed of such a molecule:

Compare the ratios of the average speed and the RMS speed to the most probable speed:

Simulate the speed of 100 hydrogen molecules in the above conditions:

The acceleration of gravity can be measured by measuring a pendulum's period and its length using . The uncertainty in the average of five repeated measurements of the period is modeled with a BatesDistribution:

The pendulum's length has been measured using a ruler with resolution of 1 mm, so its uncertainty is modeled with a UniformDistribution:

The uncertainty in the measurement of the acceleration of gravity:

Compare to the linear approximation:

Compute the average acceleration using the exact and the linearized distributions:

Compute the scales of uncertainty:

Find the sampling estimate of the 90% confidence interval for the measured acceleration:

Properties & Relations  (6)

QuantityDistribution with dimensionless units will auto-evaluate to the magnitude distribution:

Use QuantityMagnitude and QuantityUnit to extract distribution and units:

QuantityDistribution[dist,unit] is equivalent to TransformedDistribution:

Skewness and kurtosis of a QuantityDistribution are unitless:

Joint distribution of mass and acceleration:

The unit of the moment of order (1,1) is the product of units of each component:

The moment can be interpreted as the expected value of force:

PDF of a continuous distribution with units integrates to 1 over its domain:

Reciprocal units of the density function are canceled by the unit of the measure to give unitless antiderivative:

Total probability is equal to 1:

Possible Issues  (4)

The dimensionality of the distribution and units must agree:

Specify two units for two dimensions:

The identical unit for all dimensions:

The unit conversion may map the data outside of the support of the distribution:

Estimate a quantity distribution in kilograms:

Estimate using the units of the data:

Then convert the distribution:

Setting fixed values for parameter estimation is unit dependent:

Compare standard deviations:

This is caused by:

Convert the whole quantity distribution instead:

Use converted units in call to estimation:

The magnitude of the factorial moment of a QuantityDistribution coincides with the factorial moment of the magnitude distribution:

Factorial moment expression is not homogeneous in the location and scale parameters, hence direct substitution of quantity parameters results in an error:

Wolfram Research (2016), QuantityDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityDistribution.html.

Text

Wolfram Research (2016), QuantityDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/QuantityDistribution.html.

CMS

Wolfram Language. 2016. "QuantityDistribution." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/QuantityDistribution.html.

APA

Wolfram Language. (2016). QuantityDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/QuantityDistribution.html

BibTeX

@misc{reference.wolfram_2024_quantitydistribution, author="Wolfram Research", title="{QuantityDistribution}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/QuantityDistribution.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_quantitydistribution, organization={Wolfram Research}, title={QuantityDistribution}, year={2016}, url={https://reference.wolfram.com/language/ref/QuantityDistribution.html}, note=[Accessed: 21-November-2024 ]}