Vous êtes sur la page 1sur 4

Biostatistics 100A: Laboratory Four Spring 2018

Computer Exercise and Competency Assessment

I. Computer Exercise

OBJECTIVE. To develop analytical skills involving the normal distribution. Data sets
are to be created and programmed via STATA. Also, the form of the sampling
distribution of the mean and variance of a random variable are to be explored.

DATA. Using the ‘kidney.dta’ data set , generate three sampling distributions for the
mean and variance of donor ages via a STATA program (“samples.do”).

ANALYSIS. Turn in the following:

1. Based on the program ‘samples.do’ (described below), randomly (with replacement)


generate 500 sample means (xbar) and variances (varx) for the variable dage using
samples of sizes n=5, 10, 50.
2. Demonstrate that:
a. the expectation of the sample means is equal to the population mean (assume
the original mean for donor age, N=144, is the population);
b. the variance of the sample means is approximately equal to the original variance
of dage divided by the sample size; and
c. the average of the sample variances is equal to the population variance of dage.
3. Print out summary statistics on xbar and varx for each of the three sample size runs.
Printout histograms showing the distribution of the sample means for each run.
Compare these histograms with the original histogram for dage.
4. Based on their values, what do you conclude about the mean distributions as the
sample size increases?

STATA and PROGRAMMING PROCEDURES

· Optional step: To view the file, go to the DOS prompt and enter the DOS editor by
typing

c:\> edit X:\BIO100A\SAMPLES.DO

Page1of4
Biostatistics 100A: Laboratory Four Spring 2018
Computer Exercise and Competency Assessment

Once inside the DOS editor, you should see the following code.

STATA sample.do program


/* program for generating subsamples of a variable */
program define samples /* arguments=varname,k,n */
parse "`*'", parse(" ,")
local a "`1'"
local b "`2'"
local c "`3'"

· Exit the DOS editor by pressing the Alt key, followed by typing ‘f’, and exit.
· This ‘.do’ file can be activated in STATA.
· Click on the “STATA” icon.

Page2of4
Biostatistics 100A: Laboratory Four Spring 2018
Computer Exercise and Competency Assessment

· In STATA (the dot prompt), type the following commands:

COMMAND PURPOSE

1. log using lab3.log recording commands and results to ‘lab3.log’


file.
2. use “X:\BIO100A\KIDNEY.DTA”, clear accesses the data in 'kidney.dta'.
3. run “X:\BIO100A\SAMPLES.DO” enables your program inside STATA.
4. samples dage 500 5 runs simulation to generate 500 means and
variances of randomly selected subsamples of
size 5. (NOTE that the program creates
variables xbar and varx.)
5. rename xbar m5 renames means variable to m5 representing
samples of size 5.
6. rename varx v5 renames variance variable to v5 representing
samples of size 5.
7. samples dage 500 10 same as above for subsamples of size 10.
8. rename xbar m10 same as above.
9. rename varx v10 same as above.
10. samples dage 500 50 same as above for subsamples of size 50.
11. rename xbar m50 same as above.
12. rename varx v50 same as above.
13. sum m5 v5 m10 v10 m50 v50 dage obtains summary statistics on the sample
variables and donor age.
14. log off stops sending commands and results to the
ASCII file 'lab3.log'.
15. graph7 m5, border bin(30) xlab xscale(20,50) normal
requests histogram for sample means of size 5.
16. Using mouse, place cursor over graph in window and right click mouse / Click Copy
copies graph onto clipboard. Next, open
Microsoft Word (or another word processor) and
use paste to insert clipboard graph into Word
document. Save document as lab3graphs.doc.
17. graph m10, border bin(30) xlab xscale(20,50) normal
requests histogram for sample means of size
10.
18. Using mouse, place cursor over graph in window and right click mouse / Click Copy
copies, pastes and saves graph in
lab3graphs.doc.
19. graph m50, border bin(30) xlab xscale(20,50) normal
requests histogram for sample means of size
50.
20. Using mouse, place cursor over graph in window and right click mouse / Click Copy
copies, pastes and saves graph in
lab3graphs.doc.
21. graph dage, border bin(30) xlab xscale(20,50) normal
requests histogram for donor age.
22. Using mouse, place cursor over graph in window and right click mouse / Click Copy
copies, pastes and saves graph in
lab3graphs.doc.
23. exit,clear leaves STATA.
24. In Windows, copy and save lab3.log and lab3graphs.doc to storage device
copy to a removable memory device or email

Page3of4
Biostatistics 100A: Laboratory Four Spring 2018
Computer Exercise and Competency Assessment

files for analysis.

II. Competency Assessment

C6. Describe basic concepts of random variation and commonly used statistical
probability distributions.

To successfully complete this competency, complete the analysis write-up for


Laboratory 4's computer exercise (listed on Page 1 above) and answer the following
question:

If we assume that male and female births are equally likely:

a. In a family of three children, what is the probability of 2 boys and 1 girl?

b. In a family of four children, what is the probability of 2 boys and 2 girls?

Due date: Both computer exercise and competency assessment are due one
week after your lab section

Page4of4

Vous aimerez peut-être aussi