### IGP 304: Stata Labs

#### Some words from the instructor

Knowing the software is vital to your learning of statistics and your course performance. If you learn statistics without knowing the software, you will become crippled, armed with theory and methods and ideas but not knowing how to put them into practice.

These exercises are designed as stimulants to learning Stata and exploring its capabilities. These exercises will be treated the same way as assigned reading materials, and I will check if you have tried these exercises by randomly picking some of you to tell us how you would carry out the procedures.

If you don't have Stata installed on your own computers or lab computers, you can have access to it at College of Arts & Science Microcomputer Labs. [The labs are open to all with Vanderbilt ID but you may not be able to enter the buildings at night. At least you can go there during the day. The version they have is version 8, not 9. Version 8 should do all we want to do, probably with the same commands but somewhat different menu setup.]

If you have chosen software packages other than Stata, please let me know.

#### Source of data sets and examples

• Some of materials were copied/modified from course materials of Biostatistics, M.P.H. program at Vanderbilt University, and the course textbook, "Statistical Modeling for Biomedical Researchers", 2nd Ed., in press, by William Dupont. [WD] refers to William Dupont's book

#### Assigned on 01/15

See Table 4.1
• enter a dataset displayed in Table 4.1
• assign the data description
• label each variable
• use `codebook`, `describe`, and `summarize`
• save the commends that used so far in the review window as do file

#### Assigned on 01/17

Practice what you learned about graphing using STATA
• download Haemoglobin and use `infile` command to import the data: `infile id hemo using "C:\Teaching\IGP\data\haemoglobin.txt", clear`
• make a box plot : go to Stata pulldown menus --> Graphics --> Box plots, choose hemo in the box called "Variables"
• observe what appears in the review window

#### Assigned on 01/19

You can modify the code provided in Stata notes for classes for [EMS] Chapter 3.
• see `help axis_options`
• make Fig. 3.8: put a main title and a subtitle (name them whatever you want) using `title` and `subtitle`
• make Fig. 3.9: put the x title, add the x tick marks to the x-axis from 7 to 11 in units of 1, and add the x minor tick marks to the x-axis at 7.5, 8.5, 9.5, 10.5
• make Fig. 3.10-3.11: put x and y axis labels and tick marks, and put the main, x and y axis titles
• make Fig. 3.12: put a main title and the y axis title

#### Assigned on 01/22

• Use Haemoglobin in Table 3.2:
• calculate the mean and standard deviation for haemoglobin using the code provided in Stata notes for classes [EMS] Chapter 4.
• compare the results with the output using `summarize`
• Stata Lab: calculate the following values using the code provided in Stata notes for classes [EMS] Chapter 5
• find the area in upper tail of the standard normal distribution for _z = 1.975_
• find the area in lower tail of the standard normal distribution for _z = -1.95_
• find the area of the standard normal distribution between two values, _z = -1_ and _z = 1_
• find the area of the standard normal distribution between two values, _z = -2.58_ and _z = 2.58_

#### Assigned on 01/24

• R Lab: The purpose of this lab is to examine how the standard deviation of a population and the sample size of a trial affect the standard errors using the code provided in R notes [EMS] Chapter 4.
• open a text editor
• copy the code to the text editor
• change the values of the s.d of the population _sigma_ and the number of observation in each sample, n e.g. `sigma <- 20` , `n <- 5` in R
• copy the modified code and paste to R (do not copy the whole commands; copy several lines at each time)
• observe how the standard errors change as function of _sigma_ and n

#### Assigned on 01/26

• Calculate confidence interval for a mean for [EMS] Example 6.3 on page 55 using the code provided in Stata notes for classes [EMS] Chapter 6

#### Assigned on 02/05

• Generate ANOVA Table 9.1 (c) using the code provided in Stata notes for classes [EMS] Chapter 9
• then calculate F value

#### Assigned on 02/07

• Reproduce the tables on Chapter 10 using the code provided in Stata notes for classes [EMS] Chapter 10
• Draw a scatter plot with the estimated linear regression line and 95% confidence band

#### Assigned on 02/09

• Learn how to run simple linear regression

#### Assigned on 02/12

• Reproduce Table 11.3 and 11.4 on Chapter 11 using the code provided in Stata notes for classes [EMS] Chapter 11
• Learn how to generate dummy variables

#### Assigned on 02/14

• Draw inverse normal plots and plots of residuals against fitted values on Chapter 12 using the code provided in Stata notes for classes [EMS] Chapter 12

Topic revision: r22 - 01 Mar 2007, LeenaChoi

• Biostatistics Webs Copyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback