Message Boards Message Boards

Plotting a Dirichlet distribution with 4 components

Posted 1 year ago

Dear all, I would like to plot the contour plots of a Dirichlet distribution with 4 components. It is usually challenging to plot a Dirichlet for more than 3 components, as I need to generate first the mesh over a tetrahedron and then evaluate the density over the 3D mesh. I was wondering if this is something that Wolfram can do more straightforwardly, by mainly plotting the contour plots over the tetrahedron. I tried the following basic change: but this did not render any plot.

Table[Plot3D[
  PDF[DirichletDistribution[{\[Alpha]1, 3, 2, 4}], {x, y}], {x, 0, 
   1}, {y, 0, 1}, PlotRange -> All, MeshFunctions -> {#3 &}, 
  MeshShading -> {None, Red, None, Yellow}, 
  PlotPoints -> 10], {\[Alpha]1, {1, 2, 3}}]
POSTED BY: SB Yacoubi

I do not have specific experience with Dirichlet distribution, but here the basic issue seems to be: A Dirichlet distribution with 4 parameters lives in a 3D space, i.e. you need to use 3 variables. So - you can rather try e.g.:

Table[DensityPlot3D[PDF[DirichletDistribution[{\[Alpha]1, 3, 2, 4}], {x, y, z}], {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, PlotRange -> All, PlotPoints -> 30], {\[Alpha]1, {1, 2, 3}}]

or

Table[SliceContourPlot3D[PDF[DirichletDistribution[{\[Alpha]1, 3, 2, 4}], {x, y, z}], {{"ZStackedPlanes", 5}, {"YStackedPlanes", 5}}, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, PlotRange -> All, 
  PlotPoints -> 30], {\[Alpha]1, {1, 2, 3}}]

Does that make sense to you?

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract