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

# Re: st: 2 dimensional graph for joint distribution

 From Lulu Zeng <[email protected]> To [email protected] Subject Re: st: 2 dimensional graph for joint distribution Date Thu, 31 Oct 2013 20:06:12 +1100

Dear Statalist,

My apologies for keep coming back with the same topic.

I am trying to use -surface- to graph the joint distribution of odo
and bill. I want the value of odo on the x axis and bill on y axis,
and their joint distribution jd (a square matrix) on the z axis. jd is
calculated from share, which is the individual distribution of odo and
bill.

I understand -surface- needs the z axis to be a singular variable,
however, my jd is a n by n matrix (calculated by share multiplied by
its inverse).

Could you please advise if there is a way to do this?

Best Regards,
Lulu

On Thu, Oct 31, 2013 at 11:56 AM, Joe Canner <[email protected]> wrote:
> Lulu,
>
> -surface- just plots the points in your data set; it does not compute anything.  I am working on a interpolation/smoothing program that will feed data into -surface-.  I'm not sure if it will meet your needs, but if you are interested in trying it out, please send me a private message.
>
> Regards,
> Joe
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Lulu Zeng [[email protected]]
> Sent: Wednesday, October 30, 2013 8:44 PM
> To: [email protected]
> Subject: Re: st: 2 dimensional graph for joint distribution
>
> Dear Statalist
>
> Thank you all for the valuable advices.
>
> Given the bar chart is not an ideal representation as recommended by
> most if you, and a 3D graph is need in my case, the user written
> command by Andrian Mander -surface- could be an option for me as
> suggested by some of you.
>
> However, I am experiencing some trouble with surface graph. The graph
> is not in a bell shape as expected, it's got very few data points on
> the z axis and are sharp points.
>
> All I did was: surface odo bill share
>
> I suspect the issue is I need to calculate the joint probability for
> odo and bill before graphing as oppose to graphing using share
> directly (share gives the individual distribution for odo and bill).
> Please note I have 1500 data points for each variable, the example I
> gave in my earlier email is made up for demonstration.
>
> Could you please advise if Stata calculates joint distribution
> automatically in the surface command? Also it would be appreciated if
> you know any alternative way of doing the calculation and graph in one
> go.
>
> Thank you very much in advance!
>
> Best Regards
> Lulu
>
>
>
>
> On Thu, Oct 31, 2013 at 1:54 AM, David Hoaglin <[email protected]> wrote:
>> Lulu,
>>
>> That graph in Train's paper is definitely a type of display that one
>> should avoid.
>>
>> Unless you have a fairly large number of combinations of the
>> coefficients of odo and bill, you will have little way to develop the
>> surface corresponding to the joint density function of those
>> coefficients.
>>
>> For numbers of combinations like the six in your example, it might
>> work to use a "bubble plot" --- a scatter plot of the coefficient of
>> bill against the coefficient of odo in which each point is plotted as
>> a circle whose area is proportional to share.  I don't know whether
>> such a plot is readily available in Stata.
>>
>> Regards,
>>
>> David Hoaglin
>>
>> On Wed, Oct 30, 2013 at 7:07 AM, Lulu Zeng <[email protected]> wrote:
>>> 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
>>> paper: http://elsa.berkeley.edu/~train/EMtrain.pdf
>>>
>>> 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.
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/