# st: RE: Re: Examining sampling distribution

 From "Nick Cox" To Subject st: RE: Re: Examining sampling distribution Date Tue, 17 Nov 2009 10:43:04 -0000

```You could add the curve of a function by using -twoway function- in
conjunction with your histogram command. If it's -histogram-, you do
that via -addplot()-. If it's -twoway histogram-, you do that via
superimposition using the () or || notation.

But there is a much, much, much better way for you to proceed. -qchi-
and -pchi- are built-in commands for your exact purpose that allow you
to focus on the overall form of the distribution without any arbitrary
decisions about bin width (or possibly origin, although that presumably
is 0 in your case) and without the contortions of comparing bin heights
with a nonlinear curve. You should compare plots with a portfolio of
similar plots showing random draws from a chi-square(1).

My prejudice is that a good or lousy fit will be self-evident on such
plots. Otherwise, consider the usual menagerie of Kolmogorov-Smirnov,
etc.
The portfolio technique provides an informal test.

Nick
n.j.cox@durham.ac.uk

Babak Oskooei

I have a question with respect to examining the sampling distribution
visually and using statistical tests. I have carried out simulations in
Stata with 5,000 replicates and obtained the statistic of interest. The
sampling distribution of this statistics should be distributed as
Chi-squared with 1 df. I would like to test this visually and unsing
ststistical tests.

My question is how I can add a curve of Chi2 distribution with 1 df to
the histogram of the sampling distribution of my statistic. I know that
in many softwares this is possible but I do not know how to do this in
Stata. I found many options like kdensity in the histogram command but
not an option which fits a curve with a specific distribution to my
histogram. Also, I would like to know the name of the command in Stata
which I tests this statistically.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```