Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: plot 3 normal distribution on one graph

From   WEBER Sylvain <>
To   "<>" <>
Subject   Re: st: plot 3 normal distribution on one graph
Date   Tue, 6 Nov 2012 06:50:59 +0000


You receive this error because - #delimit - is a command that cannot be used interactively. It can only be used in .do or .ado files. Look for the help of this function. 
The code will work if you paste it in a do file and then run the do file. 
The other solution would be to copy the code from "graph twoway" until "graphregion(fcolor(white))", _without ;_, remove all the carriage returns so that all the code is on a single line, and then paste it into the Command window. 

Hope this helps. 


Le 5 nov. 2012 à 22:24, "yannan shen" <> a écrit :

> 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:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index