STAT 13

(Sec. 1a-1c)

Introduction to Statistical Methods for the Life and Health Sciences

Instructor: Ivo Dinov, Asst. Prof.

Departments of Statistics & Neurology
    http://www.stat.ucla.edu/~dinov/


Lab 6

Also see this for an additional tutorial.

Thursday, Nov. 08, 2001

In this lab, you will generate both Binomial and Normal observations, and simulate the convergence of the Binomial to the Normal for large n.

Set the seed to your 9-digit SID#:

set seed your_id

First, remind yourself what the normal approximation to a histogram might look like; generate 1000 standard normal observations:

set obs 1000
gen x = invnorm(uniform())

Make a histogram of the observations (use at least 10 bins) and superimpose a normal curve on the graph. (To superimpose a normal curve, use the norm option for graph: graph varname, bin(10) norm.) How well does the curve seem to approximate the histogram?

Now, generate 1000 observations of a binomial (n = 10, p = .5) random variable with the Stata command:

rndbin 1000 .5 10

This command produces a variable called xb. Make a histogram of the distribution with graph xb and assess how well the normal distribution fits.

Continue generating sets of 1000 binomials with p = .5, increasing n until the normal distribution provides a reasonably good approximation. How large an n did it take?

Now, generate 1000 observations of a binomial (n = 10, p= .2). Is the distribution of the observations well-approximated by the normal? Continue generating sets of 1000 binomials with p = .2, increasing n until the normal distribution provides a reasonably good approximation. How large an n did it take this time?

Now, generate 1000 observations of a binomial (n = 100, p= .01). Is the distribution of the observations well-approximated by the normal? Continue generating sets of 1000 binomials with p = .01, increasing n until the normal distribution provides a reasonably good approximation. How large an n did it take this time?


You may want to try some additional examples.
And compare your work to the template solution (this is not a unique solution, just a template)
\Ivo D. Dinov, Ph.D., Departments of Statistics and Neurology, UCLA School of Medicine/