# Re: st:Overlaid curves

 From absc11@bangor.ac.uk To statalist@hsphsun2.harvard.edu Subject Re: st:Overlaid curves Date Sun, 21 Mar 2004 20:16:55 +0000

```Nick,

First of all, I would like to thank you for your reply.
I have already tried what you suggested, as you have suggested to me and other
people more than one time in the past.

A couple of weeks ago this was working fine:
-twoway histogram myvar || function f = normden(x,<mean>,<sd>), at(myvar)-
However for some reason, before posting the original query and aafter I received
your reply this doesnt work and I get the following error message:

version 8.2 not supported
r(9);

Can you (or someone else that can help) please interpred what does this mean
exactly. I'm using Stata 8 for Windows XPpro, and I have already -update all-.

Dimitris

Quoting Nick Cox <n.j.cox@durham.ac.uk>:

> 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
> n.j.cox@durham.ac.uk
>
> absc11@bangor.ac.uk
>
> > 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/
>

--
This mail sent through http://webmail.bangor.ac.uk
*
*   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/
```