Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Overlaid curves


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Overlaid curves
Date   Sun, 21 Mar 2004 16:38:54 -0000

One basic technique is 

twoway histogram myvar || function f = normden(x,<mean>,<sd>), at(myvar) 

You can extend this to add other curves. The same idea also applies 
with -twoway kdensity-. 

In your case you presumably need code to estimate parameters for 
other distributions you think are of interest. For what it's worth, it 
would seem by far the best idea to fit distributions that have support 
[-1,1]. Stata's main idea here is not to provide code for the hundreds 
(thousands?) of distributions in the literature, but to provide the 
general tools (like -ml-) to let you write your own fitting program. 

In terms of functions supported by Stata, see help on -mathfun- and 
-probfun-. 

Nick 
[email protected] 

[email protected]
 
> I have a dataset that is potentially contaminated by samples 
> from more than one
> population (implications from bimodality). 
> 
> I need to graph the histogram (or maybe the kernel) of the 
> unified sample and on
> the same time to overlay three more curves.
> (1)The -normal- curve that exists in the options of -hist- or 
> -kdensity-;
> (2)Another bell-shaped curve:, e.g. Normal(mean=-.01,sd=2) or
> Logistic(a=-.01,b=2);
> (3)And a positively distrituted curve, e.g. Generalised
> Beta(a1=0.01,a2=2,min=0,max=1) or Lognormal(mean=0.01,sd=2).
> 
> The particularity of my sample is that it takes values only 
> in the [-1,1]
> interval. I realise that the normal or the student 
> distribution are not the
> best fitts for such a sample, but the case of the  Beta seems 
> to be a good
> solution for one of the curves (positively distributed) that I wish to
> overlay.
> The personalised bell-shaped curve is to exhibit (manualy) 
> the existence of
> another mode in the distribution and I dont mind if the tails 
> go further than
> the [-1,1] interval. However, it would be nice if I could fit 
> Pearson-Type of
> curves with finite-limits.
> 
> I would like to know how can I overlay the separate curves 
> with the personalised
> parameters, and also if there is a 'library' of supported 
> distributions in Stata.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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