Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: 2 dimensional graph for joint distribution

From   Joe Canner <>
To   "" <>
Subject   st: RE: 2 dimensional graph for joint distribution
Date   Wed, 30 Oct 2013 13:00:02 +0000


Based on the example in the Train paper, it appears that you want a three-dimensional plot, not a two-dimensional plot.  That is, -odo- and -bill- on the x- and y-axis and -share- on the z-axis.  

I am not aware of a Stata command (built-in or user-written) to do this as a bar graph (as in the Train paper).  The closest thing is -surface- from SSC which does wireframe surface plots.  You can use the -nowire- option to plot each point separately with a dropline instead of connecting them with a wire frame.

. surface odo bill share, nowire

You might also want to check out Stata's -graph twoway contour- which is designed for plotting three variables in two dimensions.

Joe Canner
Johns Hopkins University School of Medicine

-----Original Message-----
From: [] On Behalf Of Lulu Zeng
Sent: Wednesday, October 30, 2013 7:07 AM
Subject: st: 2 dimensional graph for joint distribution

Dear Statalist

I am having trouble creating a two dimensional joint distribution bar graph in Stata.

I'm trying to graph the joint distribution of 2 coefficients I estimated from a nonparametric choice model using fixed mass point method following Kenneth Train's approach in his 2008 paper (EM Algorithms for nonparametric estimation of mixing distributions). The graph I am trying to make is similar to the one on page 65 of Train's

My 2 coefficients (both discrete) are called odo and bill, and the variable share gives the distribution of the 2 coefficients (share adds up to 1), for example:

odo       bill        share
0.25      0.58      0.15
0.48      0.93      0.17
0.33      0.20      0.09
0.76      0.64      0.23
0.87      0.28      0.25
0.53      0.83      0.11

I want to graph the joint distribution of odo and bill with them on the x axis (2 dimensions), and their joint distribution shown as percentages on the y axis.

Thank you very much for your help in advance.

Best Regards,
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index