({{, (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution])[dist,k]
represents a univariate marginal distribution of the k(^th) coordinate from the multivariate distribution dist.}, {, (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution])[dist,{(Subscript[k, 1]),(Subscript[k, 2]),…}]
represents a multivariate marginal distribution of the {(Subscript[k, 1]),(Subscript[k, 2]),…} coordinates.}})

OpenersNotesSection(Spacer1)Details

The distribution dist can be either a discrete or continuous multivariate distribution.

For a discrete multivariate distribution dist with PDF f(x), the PDF of (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution])[dist,{(Subscript[k, 1]),…,(Subscript[k, m])}] is given by (∑_(x∖ξ))f(x) where ξ={(Subscript[x, (Subscript[k, 1])]),…,(Subscript[x, (Subscript[k, m])])}.

For a continuous multivariate distribution dist with PDF f(x), the PDF of (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution])[dist,{(Subscript[k, 1]),…,(Subscript[k, m])}] is given by (∫_(x∖ξ))f(x)dx where ξ={(Subscript[x, (Subscript[k, 1 ])]),…,(Subscript[x, (Subscript[k,  m ])])}.

(RefLink[MarginalDistribution, paclet:ref/MarginalDistribution]) can be used with such functions as (RefLink[Mean, paclet:ref/Mean]), (RefLink[CDF, paclet:ref/CDF]), and (RefLink[RandomVariate, paclet:ref/RandomVariate]), etc.

OpenersPrimaryExamplesSection(Spacer1)Examples  (48)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

One-dimensional marginal distributions:

MarginalDistribution[BinormalDistribution[ρ],1]

MarginalDistribution[MultinomialDistribution[n,{p1,p2,p3}],1]

Two-dimensional marginal distributions:

MarginalDistribution[DirichletDistribution[{α1,α2,α3,α4}],{1,2}]

MarginalDistribution[MultivariatePoissonDistribution[μ,{μ1,μ2,μ3}],{2,3}]

Marginal distributions can be used like any other distribution:

ℳ=MarginalDistribution[NegativeMultinomialDistribution[10,{1/3,1/3,1/6}],2]

PDF[ℳ,x]

DiscretePlot[%,{x,0,40}]

OpenersExampleSection1(Spacer1)Scope  (34)

OpenersExampleSubsection0(Spacer1)Basic Uses  (8)

Find the second univariate marginal distribution:

𝒟=UniformDistribution[{{a,b},{c,d},{e,f}}];

MarginalDistribution[𝒟,2]

Multivariate marginals depend on the coordinate order given:

{MarginalDistribution[𝒟,{3,1}],MarginalDistribution[𝒟,{1,3}]}

Univariate marginals behave as univariate distributions:

𝒟=ProbabilityDistribution[ Exp[-x ^2y ],{x,1,∞},{y,0,∞}];

ℳ1=MarginalDistribution[𝒟,1]

Find distribution functions:

{PDF[ℳ1,x],CDF[ℳ1,x]}

Table[Plot[df[ℳ1,x]//Evaluate,{x,1,10},PlotLabel->df,Filling->Axis,AxesOrigin->{0,0},PlotRange->All],{df,{PDF,CDF,SurvivalFunction,HazardFunction}}]

Multivariate marginals behave like a multivariate distribution:

𝒟=ProbabilityDistribution[3x (y^2) (E^(-z)),{x,0,1},{y,-1,1},{z,0,∞}];

ℳ12=MarginalDistribution[𝒟,{1,2}]

Find distribution functions:

{PDF[ℳ12,{x,y}],CDF[ℳ12,{x,y}]}

Table[Plot3D[df[ℳ12,{x,y}]//Evaluate,{x,0,1},{y,-1,1},PlotLabel->df],{df,{PDF,CDF,SurvivalFunction,HazardFunction}}]

Special moments are computed for each univariate marginal distribution:

𝒟=ProbabilityDistribution[6( x-y/2)^2,{x,0,1},{y,0,1}];

ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Compare moments of marginal distributions with the moment of original distribution:

{{Mean[ℳ1],Mean[ℳ2]},Mean[𝒟]}

{{Variance[ℳ1],Variance[ℳ2]},Variance[𝒟]}

{{Skewness[ℳ1],Skewness[ℳ2]},Skewness[𝒟]}

{{Kurtosis[ℳ1],Kurtosis[ℳ2]},Kurtosis[𝒟]}

A general multivariate moment cannot typically be found from marginal moments:

{Moment[𝒟,{1,3}],Moment[ℳ1,1]Moment[ℳ2,3]}

Quantile functions can be computed for univariate marginal distributions:

𝒟=ProbabilityDistribution[6 x^2 y,{x,0,1},{y,0,1}];
ℳ1=MarginalDistribution[𝒟,1]

Find the quantile functions:

𝒬1=Quantile[ℳ1,q]

Plot[𝒬1,{q,0,1},Filling->Axis]

Or special medians:

Median[ℳ1]

InterquartileRange[ℳ1]

Generate random variates from (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution]):

𝒟=ProbabilityDistribution[6 x^2 y,{x,0,1},{y,0,1}];
ℳ1=MarginalDistribution[𝒟,1]

sample=RandomVariate[ℳ1,10^3];

Compare the histogram to the plot of the PDF of the marginal distribution:

Show[Histogram[sample,{0,1,.01},"PDF"],Plot[PDF[ℳ1,x]//Evaluate,{x,0,1},PlotStyle->Thick]]

Estimate distribution parameters:

data=RandomVariate[MarginalDistribution[NegativeMultinomialDistribution[10,{.2,.3,.1}],1],10^3];

edist=EstimatedDistribution[data,MarginalDistribution[NegativeMultinomialDistribution[n,{.2,.3,.1}],1]]

Define a trivariate probability distribution:

𝒟=ProbabilityDistribution[ 1/10  x (y^3) (E^(- z)),{x,0,1},{y,1,3},{z,0,∞}];

Find marginal distributions:

ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];
ℳ3=MarginalDistribution[𝒟,3];

Plot[{PDF[ℳ1,u],PDF[ℳ2,u],PDF[ℳ3,u]}//Evaluate,{u,0,3},Filling->Axis,PlotLegends->{"ℳ1","ℳ2","ℳ3"}]

Find the covariance matrix of 𝒟:

Covariance[𝒟]//MatrixForm

The variances of the marginals form the diagonal of the covariance matrix of 𝒟:

{Variance[ℳ1],Variance[ℳ2],Variance[ℳ3]}

OpenersExampleSubsection1(Spacer1)Parametric Distributions  (2)

The marginal distributions of many multivariate parametric distributions automatically simplify:

𝒟=DirichletDistribution[{α1,α2,α3,α4}];

The univariate marginals follow (RefLink[BetaDistribution, paclet:ref/BetaDistribution]):

MarginalDistribution[𝒟,1]

The multivariate marginals follow (RefLink[DirichletDistribution, paclet:ref/DirichletDistribution]):

MarginalDistribution[𝒟,{1,2}]

In some cases, marginal distributions will not automatically simplify:

𝒟=MultinomialDistribution[100,{.3,.5,.2}];

Univariate marginals simplify to a (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution]):

MarginalDistribution[𝒟,1]

The multivariate marginals do not simplify:

ℳ12=MarginalDistribution[𝒟,{1,2}]

The resulting marginal can still be used like any other distribution:

DiscretePlot3D[PDF[ℳ12,{x,y}]//Evaluate,{x,10,50},{y,35,60},ExtentSize->1]

OpenersExampleSubsection2(Spacer1)Nonparametric Distributions  (3)

Find marginals of an (RefLink[EmpiricalDistribution, paclet:ref/EmpiricalDistribution]):

data=RandomVariate[MultinomialDistribution[20,{.3,.4,.3}],40];
𝒟=EmpiricalDistribution[data];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Cumulative distribution function of the marginal distributions:

Table[DiscretePlot[CDF[d,x],{x,data[[;;,1]]},ExtentSize->Right],{d,{ℳ1,ℳ2}}]

Find marginals for a (RefLink[SmoothKernelDistribution, paclet:ref/SmoothKernelDistribution]):

data=RandomVariate[BinormalDistribution[.4],30];
𝒟=SmoothKernelDistribution[data];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Table[Plot[PDF[d,x],{x,-2,2},Filling->Axis],{d,{ℳ1,ℳ2}}]

Find marginals of a (RefLink[HistogramDistribution, paclet:ref/HistogramDistribution]):

data=RandomVariate[MultivariatePoissonDistribution[10,{1,8}],100];
𝒟=HistogramDistribution[data];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Table[Plot[PDF[d,x],{x,0,30},Filling->Axis],{d,{ℳ1,ℳ2}}]

Compare to the histograms of the components:

Table[Histogram[data[[All,i]],Automatic,"PDF"],{i,2}]

OpenersExampleSubsection3(Spacer1)Derived Distributions  (9)

Find the marginal distribution of a (RefLink[MarginalDistribution, paclet:ref/MarginalDistribution]):

𝒟=NegativeMultinomialDistribution[n,{p1,p2,p3,p4}];
ℳ=MarginalDistribution[𝒟,{1,3,4}]

The second marginal of ℳ is the third marginal of 𝒟:

MarginalDistribution[ℳ,2]

Find marginals of a (RefLink[CopulaDistribution, paclet:ref/CopulaDistribution]):

𝒟=CopulaDistribution[{"Frank",3}, {NormalDistribution[μ,σ], ExponentialDistribution[λ]}];

ℳ1=MarginalDistribution[𝒟,1]

ℳ2=MarginalDistribution[𝒟,2]

Find marginals of a (RefLink[TruncatedDistribution, paclet:ref/TruncatedDistribution]):

𝒟=TruncatedDistribution[{{1/2,2/3},{1/3,4/5}},DirichletDistribution[{1,3,6}]];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Probability density function:

pdf1=PDF[ℳ1,x]//FullSimplify

pdf2=PDF[ℳ2,x]//FullSimplify

Plot[{pdf1,pdf2},{x,0.3,0.6},Filling->Axis,PlotRange->All]

Find marginals of a (RefLink[MixtureDistribution, paclet:ref/MixtureDistribution]):

𝒞1=BinormalDistribution[{μ1,μ2},{σ1,σ2},ρ];
𝒞2=MultivariateTDistribution[{{1,p},{p,1}},ν];
𝒟=MixtureDistribution[{a,b},{𝒞1,𝒞2}];

Each marginal distribution is the mixture of marginals:

MarginalDistribution[𝒟,1]

MarginalDistribution[𝒟,2]

Compare with the marginal distributions of the components:

{MarginalDistribution[𝒞1,1],MarginalDistribution[𝒞1,2]}

{MarginalDistribution[𝒞2,1],MarginalDistribution[𝒞2,2]}

Marginals of a (RefLink[MixtureDistribution, paclet:ref/MixtureDistribution]) are mixtures of marginals:

𝒟=MixtureDistribution[{4,1},{MultivariatePoissonDistribution[1,{7,12}],MultivariatePoissonDistribution[1,{1,2}]}];

ℳ1=MarginalDistribution[𝒟,1]

ℳ2=MarginalDistribution[𝒟,2]

Plot a probability density function for both marginals:

DiscretePlot[Evaluate[{PDF[ℳ1,x],PDF[ℳ2,x]}],{x,0,20},PlotMarkers->Automatic]

Create a bivariate distribution using marginal distributions:

𝒫=ProductDistribution[ℳ1,ℳ2];

Compare a PDF of the original distribution 𝒟 with the (RefLink[ProductDistribution, paclet:ref/ProductDistribution]) of marginals:

{DiscretePlot3D[PDF[𝒟,{x,y}],{x,0,15},{y,0,25},ExtentSize->Full],DiscretePlot3D[PDF[𝒫,{x,y}],{x,0,15},{y,0,25},ExtentSize->Full]}

Compare covariance matrices:

MatrixForm/@{Covariance[𝒟],Covariance[𝒫]}

Find marginal distributions of a (RefLink[TransformedDistribution, paclet:ref/TransformedDistribution]):

𝒟=TransformedDistribution[{u/2,u+ v/3},{u,v}\[Distributed]BinormalDistribution[{2,1},{1/2,1},0.4]];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Plot[Evaluate[{PDF[ℳ1,x],PDF[ℳ2,x]}],{x,0,4},Filling->Axis]

Find marginal distributions of a (RefLink[ParameterMixtureDistribution, paclet:ref/ParameterMixtureDistribution]):

𝒟=ParameterMixtureDistribution[BinormalDistribution[ρ],ρ\[Distributed]BetaDistribution[2,3]];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Visualize the probability density function:

{SmoothHistogram[RandomVariate[ℳ1,10^3],Automatic,"PDF",Filling->Axis],SmoothHistogram[RandomVariate[ℳ2,10^3],Automatic,"PDF",Filling->Axis]}

Find marginal distributions of an (RefLink[OrderDistribution, paclet:ref/OrderDistribution]):

𝒟=OrderDistribution[{ErlangDistribution[2,3.5],4},{1,4}];
ℳ1=MarginalDistribution[𝒟,1];
ℳ2=MarginalDistribution[𝒟,2];

Probability density function:

Table[Plot[Evaluate[PDF[m,x]],{x,0,2},PlotRange->{0,3.2},Filling->Axis],{m,{ℳ1,ℳ2}}]

Mean:

{Mean[ℳ1],Mean[ℳ2]}

Variance:

{Variance[ℳ1],Variance[ℳ2]}

Marginals of a (RefLink[QuantityDistribution, paclet:ref/QuantityDistribution]) give (RefLink[QuantityDistribution, paclet:ref/QuantityDistribution]):

𝒟=QuantityDistribution[MultivariateTDistribution[{{1,1/2,-1/3},{1/2,1,0},{-1/3,0,1}},7],{"Grams","Meters","Seconds"}]

Univariate marginal:

MarginalDistribution[𝒟,2]

Multivariate marginal:

MarginalDistribution[𝒟,{1,3}]

OpenersExampleSubsection4(Spacer1)Automatic Simplifications  (12)

OpenersExampleSubsubsection0(Spacer1)Discrete Parametric Distributions  (3)

Marginals of multivariate (RefLink[DiscreteUniformDistribution, paclet:ref/DiscreteUniformDistribution]) again follow a uniform distribution:

𝒟=DiscreteUniformDistribution[{{a,b},{c,d},{e,f}}];

MarginalDistribution[𝒟,2]

MarginalDistribution[𝒟,{1,3}]

Univariate marginals of (RefLink[MultivariatePoissonDistribution, paclet:ref/MultivariatePoissonDistribution]) follow (RefLink[PoissonDistribution, paclet:ref/PoissonDistribution]):

𝒟=MultivariatePoissonDistribution[μ,{μ1,μ2,μ3}];

MarginalDistribution[𝒟,1]

Multivariate marginals again follow multivariate Poisson distribution:

MarginalDistribution[𝒟,{2,3}]

Univariate marginals of (RefLink[MultinomialDistribution, paclet:ref/MultinomialDistribution]) follow (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution]):

𝒟=MultinomialDistribution[n,{p1,p2,p3}];

MarginalDistribution[𝒟,3]

OpenersExampleSubsubsection1(Spacer1)Continuous Parametric Distributions  (6)

Marginals of (RefLink[BinormalDistribution, paclet:ref/BinormalDistribution]) follow (RefLink[NormalDistribution, paclet:ref/NormalDistribution]):

𝒟=BinormalDistribution[{μ1,μ2},{σ1,σ2},ρ];

{MarginalDistribution[𝒟,1],MarginalDistribution[𝒟,2]}

All univariate marginals of (RefLink[MultinormalDistribution, paclet:ref/MultinormalDistribution]) follow (RefLink[NormalDistribution, paclet:ref/NormalDistribution]):

Σ=(({{((σ1)^2), ρ12 σ1 σ2, ρ13 σ1 σ3}, {ρ12 σ1 σ2, ((σ2)^2), ρ23 σ2 σ3}, {ρ13 σ1 σ3, ρ23 σ2 σ3, ((σ3)^2)}}));

𝒟=MultinormalDistribution[{μ1,μ2,μ3},Σ];

MarginalDistribution[𝒟,2]

Multivariate marginals of (RefLink[MultinormalDistribution, paclet:ref/MultinormalDistribution]) are multivariate normal:

MarginalDistribution[𝒟,{2,3}]

Marginals of multivariate (RefLink[UniformDistribution, paclet:ref/UniformDistribution]) follow uniform distribution:

𝒟=UniformDistribution[{{a,b},{c,d},{e,f}}];

MarginalDistribution[𝒟,3]

MarginalDistribution[𝒟,{1,2}]

One-dimensional marginals of (RefLink[DirichletDistribution, paclet:ref/DirichletDistribution]) follow (RefLink[BetaDistribution, paclet:ref/BetaDistribution]):

𝒟=DirichletDistribution[{α1,α2,α3,α4}];

MarginalDistribution[𝒟,2]

Multivariate marginals of (RefLink[DirichletDistribution, paclet:ref/DirichletDistribution]) again follow Dirichlet distribution:

MarginalDistribution[𝒟,{1,3}]

Univariate marginals of (RefLink[MultivariateTDistribution, paclet:ref/MultivariateTDistribution]) follow (RefLink[StudentTDistribution, paclet:ref/StudentTDistribution]):

𝒟=MultivariateTDistribution[{{1,0},{0,1}},ν];

{MarginalDistribution[𝒟,1],MarginalDistribution[𝒟,2]}

Univariate marginals of (RefLink[LogMultinormalDistribution, paclet:ref/LogMultinormalDistribution]) follow (RefLink[LogNormalDistribution, paclet:ref/LogNormalDistribution]):

Σ=(({{((σ1)^2), ρ12 σ1 σ2, ρ13 σ1 σ3}, {ρ12 σ1 σ2, ((σ2)^2), ρ23 σ2 σ3}, {ρ13 σ1 σ3, ρ23 σ2 σ3, ((σ3)^2)}}));

𝒟=LogMultinormalDistribution[{(Subscript[μ, 1]),(Subscript[μ, 2]),(Subscript[μ, 3])},Σ];

MarginalDistribution[𝒟,2]

Multivariate marginals of (RefLink[LogMultinormalDistribution, paclet:ref/LogMultinormalDistribution]) again follow log-multinormal distribution:

MarginalDistribution[𝒟,{1,3}]

OpenersExampleSubsubsection2(Spacer1)Derived Distributions  (3)

Marginals of (RefLink[ProductDistribution, paclet:ref/ProductDistribution]) are the component distributions:

𝒟=ProductDistribution[KDistribution[2,4],GammaDistribution[3,2],ExponentialDistribution[5]];

One-dimensional marginal:

MarginalDistribution[𝒟,3]

A two-dimensional marginal is also defined by (RefLink[ProductDistribution, paclet:ref/ProductDistribution]):

MarginalDistribution[𝒟,{1,2}]

Univariate marginals of a (RefLink[CopulaDistribution, paclet:ref/CopulaDistribution]) are the marginals used in the specification:

𝒟=CopulaDistribution[{"Frank",2},{NormalDistribution[],ExponentialDistribution[λ]}];

MarginalDistribution[𝒟,2]

Marginal distributions of a (RefLink[MixtureDistribution, paclet:ref/MixtureDistribution]) are the mixtures of component marginals:

𝒟=MixtureDistribution[{a,b},{BinormalDistribution[{μ1,μ2},{σ1,σ2},ρ],MultivariateTDistribution[{{1,p},{p,1}},ν]}];

MarginalDistribution[𝒟,1]

OpenersExampleSection3(Spacer1)Applications  (5)

Visualize univariate marginal distributions together with a bivariate distribution:

𝒟=DirichletDistribution[{2,3,2}];

gxy=Plot3D[PDF[𝒟,{x,y}],{x,0,1},{y,0,1},AxesLabel->Automatic,Mesh->None]

Plot the univariate marginals:

{gx,gy}={Plot[Evaluate[PDF[MarginalDistribution[𝒟,1],x]],{x,0,1},Filling->Axis,FillingStyle->Red],Plot[Evaluate[PDF[MarginalDistribution[𝒟,2],y]],{y,0,1},Filling->Axis,FillingStyle->Green]}

Show the results together:

Graphics3D[{First[gxy],First[gx]/.GraphicsComplex[pts_,rest__]:>GraphicsComplex[pts/.{x_,y_}->{x,0.,y},rest],First[gy]/.GraphicsComplex[pts_,rest__]:>GraphicsComplex[pts/.{x_,y_}->{0.,x,y},rest]},BoxRatios->{1,1,0.4}]

The city-highway mileage for a midsize car is given by a binormal distribution. Find the city mileage distribution:

ch𝒟=QuantityDistribution[BinormalDistribution[{18.6,26.3},{5.02,4.67},0.91],"Miles"/"Gallons"];
city=MarginalDistribution[ch𝒟,1]

Plot the probability density function:

Plot[PDF[city,Quantity[x,"Miles"/"Gallons"]],{x,6,33},Filling->Axis,AxesLabel->{"mi/gal"}]

Find the average city mileage:

Mean[city]

The male weight and height follow a binormal distribution. Find the height distribution:

maleWH=BinormalDistribution[{Quantity[195,"Pounds"],Quantity[70,"Inches"]},{Quantity[64,"Pounds"],Quantity[2,"Inches"]},0.42];
height=MarginalDistribution[maleWH,2];

Probability density function:

Plot[PDF[height,Quantity[x,"Inches"]],{x,64,76},Filling->Axis,AxesLabel->{"in"}]

Find the median height for males:

Median[height]

Find the lower quartile:

Quantile[height,.25]

Express the height distribution in meters:

UnitConvert[height,"Meters"]

A fair coin is flipped three times with the objective of getting three tails. Find the join distribution of the number of failures in the form of getting a head on the second or on the third flip:

𝒟=NegativeMultinomialDistribution[1,{1/2,1/4,1/8}];
ℳ=MarginalDistribution[𝒟,{2,3}];

Probability density function:

DiscretePlot3D[PDF[ℳ,{x,y}],{x,0,5},{y,0,5},ExtentSize->2/3]

PDF[ℳ,{x,y}]

Find the average number of failures of each kind:

Mean[ℳ]

Find the total number of failures of both kinds:

Total[Mean[ℳ]]

Simulate the number of failures by getting a head on the second or on the third flip:

sample=RandomVariate[ℳ,10]

BarChart[sample,ChartLayout->"Stacked",ChartElementFunction->"GlassRectangle"]

A university campus lies completely within twin cities A and B. On a day there are on average 10 car accidents on campus and the joint distribution of the number of accidents per day in both cities is:

𝒟=MultivariatePoissonDistribution[10,{5,10}];

Find the distribution of the number of accidents in each city:

𝒜=MarginalDistribution[𝒟,1]

ℬ=MarginalDistribution[𝒟,2]

Compare probability density functions:

DiscretePlot[PDF[ReleaseHold[#],x],{x,0,35},PlotRange->{0,0.1},ExtentSize->1/2,PlotLabel->ToString[#]]&/@{HoldForm[𝒜],HoldForm[ℬ]}

Simulate the number of accidents per day in city A for 30 days:

accidents=RandomVariate[𝒜,30];

ListPlot[{accidents,{{0,Mean[𝒜]},{30,Mean[𝒜]}}},AxesOrigin->{0,0},Filling->{1->Axis},Joined->{False,True}]

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

Use a marginal distribution if an event does not depend on all the variables:

𝒟=BinormalDistribution[{1,0},{1,1/2},0.4];
p[u_]=u^2>2;

Calculate the event probability:

Probability[p[y],{x,y}\[Distributed]𝒟]==Probability[p[y],y\[Distributed]MarginalDistribution[𝒟,2]]//FullSimplify

Find expectations if the function does not involve all the variables:

g[u_]=u^3+u;

Expectation[g[x],{x,y}\[Distributed]𝒟]==Expectation[g[x],x\[Distributed]MarginalDistribution[𝒟,1]]//FullSimplify

An n-variable multivariate distribution has (2^n)-2 proper marginal distributions:

Table[Length[Subsets[Range[n],{1,n-1}]],{n,2,10}]

Table[(2^n)-2,{n,2,10}]

Obtain the marginal CDF by taking limits of complementary variables:

𝒟=ProbabilityDistribution[((E^(-((y^2)/2)))/( (π^(3/2)) (1+(x^4)))),{x,-∞,∞},{y,-∞,∞}];

cdf=Assuming[{x,y}∈Reals,Refine[CDF[𝒟,{x,y}]]];

Compute the marginal CDF (Subscript[F, 1])(x) as (lim_(y->∞)) F(x,y):

Limit[cdf,y->∞]

CDF[MarginalDistribution[𝒟,1],x]

Simplify[%%-%]

Compute the marginal CDF (Subscript[F, 2])(y) as (lim_(x->∞)) F(x,y):

Limit[cdf,x->∞]

CDF[MarginalDistribution[𝒟,2],y]

Simplify[%%-%]

Obtain the marginal PDF by integrating over complementary variables:

𝒟=ProbabilityDistribution[((E^(-((y^2)/2)))/( (π^(3/2)) (1+(x^4)))),{x,-∞,∞},{y,-∞,∞}];

pdf=PDF[𝒟,{x,y}];

Compute the marginal PDF (Subscript[f, 1])(x) as (∫_(-∞)^∞)f(x,y)dy:

Integrate[pdf,{y,-∞,∞}]

PDF[MarginalDistribution[𝒟,1],x]

Simplify[%%-%]

Compute the marginal PDF (Subscript[f, 2])(y) as (∫_(-∞)^∞)f(x,y)dx:

Integrate[pdf,{x,-∞,∞}]

PDF[MarginalDistribution[𝒟,2],y]

Simplify[%%-%]

Multivariate marginal distributions preserve the correlation between components:

Σ=(({{((σ1)^2), ρ12 σ1 σ2, ρ13 σ1 σ3}, {ρ12 σ1 σ2, ((σ2)^2), ρ23 σ2 σ3}, {ρ13 σ1 σ3, ρ23 σ2 σ3, ((σ3)^2)}}));

𝒟=MultinormalDistribution[{μ1,μ2,μ3},Σ];

Find the marginal distribution for the first and the third components:

ℳ13=MarginalDistribution[𝒟,{1,3}]

The covariance of the marginal is a submatrix Σ:

Covariance[ℳ13]//MatrixForm

For a discrete distribution:

𝒫=MultivariatePoissonDistribution[μ,{μ1,μ2,μ3}];

Covariance matrix for 𝒫:

Covariance[𝒫]//MatrixForm

Define the marginal for the second and the third components:

ℳ𝒫23=MarginalDistribution[𝒫,{2,3}]

Covariance for ℳ𝒫23 is a submatrix of the covariance of 𝒫:

Covariance[ℳ𝒫23]//MatrixForm

OpenersExampleSection5(Spacer1)Neat Examples  (1)

All six proper marginal PDFs from a trivariate distribution:

𝒟=ProductDistribution[UniformDistribution[{0,1}],TriangularDistribution[{0,1}],BetaDistribution[2,4]];

Table[Plot[PDF[MarginalDistribution[𝒟,i],x]//Evaluate,{x,0,1},Filling->Axis,PlotLabel->{i}],{i,1,3}]

Table[
ind=Complement[{1,2,3},{i}];
Plot3D[PDF[MarginalDistribution[𝒟,ind],{x,y}]//Evaluate,{x,0,1},{y,0,1},PlotRange->All,Mesh->None,Exclusions->None,PlotPoints->35,PlotLabel->ind],{i,1,3}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CopulaDistribution, paclet:ref/CopulaDistribution])  ▪  (RefLink[ProductDistribution, paclet:ref/ProductDistribution])  ▪  (RefLink[TransformedDistribution, paclet:ref/TransformedDistribution])  ▪  (RefLink[MultinormalDistribution, paclet:ref/MultinormalDistribution])  ▪  (RefLink[MultinomialDistribution, paclet:ref/MultinomialDistribution])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Derived Statistical Distributions, paclet:guide/DerivedDistributions])}})}})