New in Wolfram
Mathematica
8: Probability and Statistics Solvers and Properties
◄
previous
|
next
►
Core Algorithms
Bivariate Discrete Distribution Functions
Compute and visualize multivariate discrete distribution functions.
In[1]:=
X
Clear[DistributionPlot3D]; DistributionPlot3D[dist_, {xmin_, xmax_}, {ymin_, ymax_}] := Block[{x, y, n, m, nmin = Floor[xmin], nmax = Ceiling[xmax], mmin = Floor[ymin], mmax = Ceiling[ymax], pdf, cdf, sf, hf}, {pdf, cdf, sf, hf} = {DiscretePlot3D[ PDF[dist, {n, m}], {n, nmin, nmax}, {m, mmin, mmax}, PlotLabel -> "PDF", PlotStyle -> Lighter[ColorData[1, 1], 0.2], Filling -> Axis, FillingStyle -> Lighter[ColorData[1, 1], 0.8], Lighting -> "Neutral", ExtentSize -> 2/3], DiscretePlot3D[ CDF[dist, {x, y}], {x, xmin, xmax}, {y, ymin, ymax}, PlotRange -> {0, 1}, PlotLabel -> "CDF", PlotStyle -> Lighter[ColorData[1, 2], 0.2], Filling -> Axis, FillingStyle -> Lighter[ColorData[1, 2], 0.8], ExtentSize -> Right, Lighting -> "Neutral"], DiscretePlot3D[ SurvivalFunction[dist, {x, y}], {x, xmin, xmax}, {y, ymin, ymax}, PlotRange -> {0, 1}, PlotLabel -> "SF", PlotStyle -> Lighter[ColorData[1, 3], 0.1], Filling -> Axis, FillingStyle -> Lighter[ColorData[1, 3], 0.4], ExtentSize -> Right, Lighting -> "Neutral"], DiscretePlot3D[ HazardFunction[dist, {n, m}], {n, nmin, nmax}, {m, mmin, mmax}, PlotLabel -> "HF", ExtentSize -> 2/3, PlotStyle -> Lighter[ColorData[1, 4], 0.0], Filling -> Axis, FillingStyle -> Lighter[ColorData[1, 4], 0.8], Lighting -> "Neutral"]}; GraphicsGrid[{{pdf, cdf}, {sf, hf}}, ImageSize -> 500] ]; DistributionPlot3D[ MultivariatePoissonDistribution[2, {1, 2}], {0, 10}, {0, 10}]
Out[1]=