1 / 60

Basics of Biostatistics for Health Research Session 2 – February 14 th , 2013

Basics of Biostatistics for Health Research Session 2 – February 14 th , 2013 Dr. Scott Patten, Professor of Epidemiology Department of Community Health Sciences & Department of Psychiatry. patten@ucalgary.ca. Go to “www.ucalgary.ca/~patten” www.ucalgary.ca/~patten Scroll to the bottom.

aradia
Download Presentation

Basics of Biostatistics for Health Research Session 2 – February 14 th , 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basics of Biostatistics for Health Research Session 2 – February 14th, 2013 Dr. Scott Patten, Professor of Epidemiology Department of Community Health Sciences & Department of Psychiatry patten@ucalgary.ca

  2. Go to “www.ucalgary.ca/~patten” www.ucalgary.ca/~patten • Scroll to the bottom. • Right click to download the files described as being “for PGME Students” • One is a dataset • One is a data dictionary • Save them on your desktop

  3. Open the Datafile

  4. The task from last week… • Create a 95% exact binomial confidence interval for the proportion of people with Framingham with > H.S. education

  5. Review of Last Week’s Task • “use” • “generate” • “recode” • “tabulate” • “ci”

  6. The actual commands… generate highschool = educ recode highschool 1/2=0 3/4=1 tabulate highschool ci highschool, binomial

  7. Creating a “do” file… 1 2 3

  8. The “do file” editor

  9. Executing a “do” file

  10. What is a “do” file? • It is a text file – you can copy and paste from the output window in Stata, or from a word processor • It is a computer program that consists of actual commands and therefore doesn’t need a compiler • Others would call it a “macro”

  11. Different Types of Data • One type of distinction • Nominal (e.g. sex, race) • Ordinal (e.g. rating scales) • Cardinal (e.g. physical measures) • Another type of distinction • Categorical (e.g. # of pregnancies) • Continuous (e.g. height, weight)

  12. Body Mass Index (BMI)

  13. The BMI in our Data Set This is an example of a continuous variable

  14. Changing Data Types in Stata(e.g. continuous to categorical) • recode bmi x/y=z • This will recode all values of the variable bmi having values from x to y to a single value equal to z.

  15. Interpretation of BMI • Underweight: < 18.5 • Normal weight: 18.5 to 25 • Over weight: >25 to 30 • Obese: 30+ • Your task: Make a “do file” that calculates a 95% confidence interval for the proportion of the population that are overweight or obese.

  16. Example of Code for this… generate owo = bmi recode owo 0/25 = 0 25.01/100 = 1 tab owo, missing ci owo, binomial

  17. Another Task… • Add a use command to your do file • Save your “do file” on the desktop using a descriptive file name of your choice • Exit Stata • Open Stata again • Open the “do file” editor and select your do file • Execute your “do file”

  18. The Power of “do files” • Task: Calculate an exact 95% CI for the proportion of the population that are obese (BMI > 30) • IMPORTANT: do NOT start from scratch as we did before – try to do this by editing your do file.

  19. For Example… generate owo = bmi recode owo 0/25 = 0 25.01/100 = 1 tab owo, missing ci owo, binomial generate owo = bmi generate obese = bmi recode owo 0/25 = 0 25.01/100 = 1 recode obese 0/30 = 0 30.01/100=1 tab owo, missing tab obese, missing ci owo obese, binomial

  20. Starting a Log File 1 2 3

  21. Closing a Log File 1 2 3

  22. Another Task… • Start a log file • Run your “do file” • Close and save the resulting log file on your desktop • Open your log file

  23. “do file” Etiquette • When you add an * before a line on a “do file” Stata will ignore that line • Use this to…. • Add descriptive comments to your code • Remove commands that you don’t want now, but might want later

  24. E.g. Without the Tables…

  25. Review… • Make a value label for obesity • Attach this value label to the variable representing obesity

  26. Making a Graphic

  27. The Pie Chart Dialogue Box 1 Find the Variable that you made 2

  28. Unedited Output

  29. The Graph Editor

  30. Here is a good place to start

  31. See if you can do these things… • Change the color of the pie • Add a title • Add a comment • Change the background • Create a work of art

  32. Save in a Standard Format

  33. Back to BMI • May not wish to categorize variables like this • Measures of central tendency • Mode • Median • Mean • Different types of graphs are useful for examining continuous variables • Box plots • Histograms

  34. Box Plots

  35. Terminology • Median: value with 50% of observations above and 50% below. • Interquartile range – contains 50% of observations – plus or minus one quartile • Adjacent values (whiskers) – observation that is less than 1.5x the IQR • Outliers: anything outside of the adjacent values

  36. Calculating Summary Stats Calculate summary stats for BMI

  37. Calculating Summary Stats Calculate the mean BMI

  38. Calculating Summary Stats Calculate median BMI

  39. Make a Box (and whisker) Plot

  40. The Boxplot Dialogue Box 1 Select BMI from the dropdown list 2

  41. Introducing Histograms 1 2

  42. The Histogram Dialogue Box Select the variable here Select the bin# here

  43. A Task for You to Do… • Make 3 histograms of BMI • In one use the default number of bins • In one use a larger number • In one, use a smaller number • Save your favorite histogram • Open it in the graph editor, give it a title and improve its appearance • Save it in a standard form (e.g. png, jpg, tif)

  44. Assessing Normality with a Histogram

  45. The distribution is not quite normal, but close

  46. Is BMI Higher in Men or Women? • We could use confidence intervals to assess this… • E.g. 1 2 3

  47. Here is the dialogue box… Once you’ve selected BMI, click this

  48. The dialogue box, continued.. Enter sex as a group variable

  49. The output

  50. It looks better with value labels

More Related