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

# Re: st: density plots

 From Maarten Buis To statalist@hsphsun2.harvard.edu Subject Re: st: density plots Date Tue, 24 May 2011 19:28:36 +0200

```On Tue, May 24, 2011 at 6:44 PM, Debs Majumdar <debs_stata@yahoo.com> wrote:

> I want is an x axis that ranges from 20 to 90 points  and 2 normal curves on it.
>
> One with mean 60 and standard error 2 and the other one with mean 40 and standard error 5.
>
> At last, I'd like you to pull some random values from those distributions
> and superimpose them, e.g. the numbers 1, 2, 3, ... 10 as symbols
> superimposed on top of the normal curves.

*--------------------------- begin example ---------------------------
clear
set obs 100
gen x = rnormal(60,2)
gen y = rnormal(40,5)
cumul x, gen(cx)
cumul y, gen(cy)

twoway function y = normal((x - 60)/2), range(20 90) || ///
function y = normal((x - 40)/5), range(20 90) || ///
scatter cx x || scatter cy y
*-------------------------- end example --------------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

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