Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: plot 3 normal distribution on one graph
From
Phil Clayton <[email protected]>
To
[email protected]
Subject
Re: st: plot 3 normal distribution on one graph
Date
Tue, 6 Nov 2012 17:52:23 +1100
The -#delimit- command can only be run from a do-file or ado-file. See -help delimit-
So I would recommend trying the code from the do-file editor. It works for me.
Phil
On 06/11/2012, at 5:24 PM, yannan shen <[email protected]> wrote:
> Dear statalist,
> I need to plot three normal distributions on one graph, I want them to
> be over each other, not side by side.
> The three distributions are:
> y1~norm(1, 2)
> y2~norm (3, 4)
> y3 is a weighted average of y1 and y2, let's say y3=.5*y1+.5*y2
>
> I found the following code from previous statalist discussion that
> looks very helpful:
>
> /* Plot two normal distributions */
> #delimit ;
> graph twoway (function y=normalden(x,1,2), range(-10 20) lw(medthick))
> (function y=normalden(x,5,3), range(-10 20) lw(medthick)),
> title("Normal-Distribution comparison")
> xtitle("Normal", size(medlarge)) ytitle("")
> xlabel(-10(2)20)
> xscale(lw(medthick)) yscale(lw(medthick))
> legend(off)
> graphregion(fcolor(white));
> #delimit cr
> /* Stata code ends */
>
> However, I copied and pasted the exact code into stata command window
> and the first line returns an error message "Unknown #command"
>
> Why??? I googled the error message but was not able to find a
> solution. I cleared the program history, closed and reopned stata, and
> tried on different computers, but was unable to find spot the problem.
> Can someone please help me? I am using stata IC 12.0
>
> Thank you very much!
> *
> * 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/