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

Re: st: 'twoway' syntax subtlety

From   Maarten buis <>
Subject   Re: st: 'twoway' syntax subtlety
Date   Wed, 15 Oct 2008 13:26:31 +0100 (BST)

--- George Hoffman <> wrote:
> I'm trying to overlay two (or more) kdensity plots.
> kdensity accepts the 'norm' option
> twoway kdensity does not - see log below
> I thought twoway calls kdensity - but I must have a misunderstanding
> of stata 10 graphics....

The -twoway- graphs allow for much more flexibility at the price of
haveing to specify more. In your case, if you want a normal cuve fitted
trouhg it, you will have to add it with the -twoway function- command,
like it in the example below:

*----------- begin example ---------------------------
sum mpg
twoway kdensity mpg || ///
       function y=normalden(x,`r(mean)',`r(sd)'), ///
       range(`r(min)' `r(max)')
*----------------- end example -----------------------

There are better methods if your aim is to assess deviations from a
normal/Gaussian distribution, like -pnorm- and -qnorm- in official
Stata, Nick Cox's -dpp- discussed in (Cox 2005) see -findit dpp-, and
my own -hangroot- see -findit hangroot-.

-- Maarten

Cox, Nicholas J. (2005) Speaking Stata: Density probability plots, The
Stata Journal 5(2): 259--273.

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index