Introduction to Statistical Methods for the Life and Health Sciences
|
This lab involves random number generation. It is meant to give you a feel for the binomial distribution.
First, obtain the probability distribution (by hand, not from the table) for a binomial random variable X with n = 10 and p = 0.3. That is, for each possible value x of X, find P(X = x).
Now, set the seed to your 9-digit student id number :
set seed your_id
Generate 1000 observations of a binomial (n = 10, p = 0.3) random variable with the Stata command:
rndbin 1000 0.3 10
This command produces a variable called xb. Make a histogram of the distribution with graph xb. How well does the observed distribution match what you expect? (You have already figured out what you expect the distribution to look like.)
Get summary statistics for the observations (using summarize or summarize, detail). What values do you expect for the mean and SD? Are the summary statistics close to the expected values?