Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | David Hoaglin <dchoaglin@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: 2 dimensional graph for joint distribution |
Date | Thu, 31 Oct 2013 23:42:49 -0400 |
Dear Lulu, The additional explanation is helpful. Thank you. The joint probability is already given by share. That is, share is the (empirical) probability of the particular combination of odo and bill. I see no justification for multiplying that column vector by its transpose. David Hoaglin On Thu, Oct 31, 2013 at 8:25 PM, Lulu Zeng <luluzengnz@gmail.com> wrote: > Dear David and others, > > Thank you for responding to my question. > > "odo" and "bill" are 2 random coefficients I obtained from a fixed > mass points nonparametric choice model, "share" is the proportion of > observations at each point of "odo" and "bill", therefore gives the > probability of "odo" and "bill" at each point. Share is the same for > odo and bill, example as below (my actual model has 1,000 points). > > odo bill share > 0.26 0.30 0.34 > 0.89 0.56 0.25 > 0.41 0.73 0.41 > > To work out the joint probability (call it "jp") of odo and bill at > each point, I multiply the colum vector "share" with its transposed > row vector as shown in table below (jp is the centre part of the matrx > below): > > bill share > > 0.34 0.25 0.41 > > 0.34 0.12 0.09 0.14 > odo share 0.25 0.09 0.06 0.10 > 0.41 0.14 0.10 0.17 > > For the surface graph, I want odo on x axis, bill on y axis, and jp on > z. I thought the graph may be bell sharped as jp is symetric. > > In my previous email, I wasn't sure how to put jp in the graph as > -surface- needs 3 variables while my jp is a matrix. > > I just figured out a potential way to solve the problem but I haven't > got the chance to try it so still unsure whether it will work. My > approach is to reshape the data -- stack all 3 colums of jp into 1 > colum and match odo, bill, and jp as one to one relationships. Example > below: > > odo bill jp > 0.26 0.30 0.12 > 0.89 0.30 0.09 > 0.41 0.30 0.14 > ................................... > 0.26 0.56 0.09 > 0.89 0.56 0.06 > 0.41 0.56 0.10 > ................................... > 0.26 0.73 0.14 > 0.89 0.73 0.10 > 0.41 0.73 0.17 > > Then I will do: surface odo bill jp > > Thank you again David, please let me know if you can see any problem > in my approach, any alternative approach greatly appreciated. > > Best Regards, > Lulu * * 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/