******************************************************************************* * Assignment 4 * BE SURE TO TYPE ALL COMMANDS YOU USE IN THIS DO FILE FOR FULL * CREDIT. * Write the answers to the questions in the commented-out space as indicated * Submit your do-file and word document (no log file needed) that includes * your final tables on the CLE by 1 pm on 9/8/20 * There are a total of 25 points in this assignment * _Your Name_ ******************************************************************************* /* Set your working directory and load the data */ version 16.1 clear capture log close *Set your working directory here: cd "Your/working/directory" *Open a new log here: log using "assignment4_log", replace *Load the nhanes2 dataset: webuse nhanes2 /* We will focus on one research question for this assignment: "Do people living in rural areas of the US have a higher probability of having a heart attack compared to people living in non-rural areas?" We will practice making nice-looking tables in Stata and Word. Remember to include both the command(s) and your answer for each question. */ /* Question 1 (3 pts) Label the values of "heartatk", "rural" according to their variable labels, and relabel the variables to a simple description (i.e., "Heart attack" and "Rural", or similar) Hint: check tab or codebook to see how the variables are labeled */ *Put your commands here: /* Question 2 (3 pts) Create a 2x2 table of the exposure ("rural") and the outcome ("heartatk") using the tabulate command. Include options so you can see what percent of people head a heart attack in each exposure group (add the col or row option, depending on how you set it up) __What percent of people in rural areas had a heart attack?__ _Answer: _ __What percent of people in urban areas had a heart attack?__ _Answer: _ */ *Put your command here: /* Question 3 (7 pts) Create a summary table of the mean values of the following variables for each category of the rural variable: age, bmi, systolic blood pressure, diastolic blood pressure, and heart attack. Have the variables in rows and the statistics in columns as shown in class. Use putdocx to have STATA export the table directly into Word. Make sure the rows and columns are labeled in Word. */ *Put your commands here: /* Question 4 (11 pts) Create a regression output table with 3 models: 1) Outcome: heartatk; Predictors: rural 2) Outcome: heartatk; Predictors: rural, age 3) Outcome: heartatk; Predictors: rural, age, bmi Use estimates table. Export the table directly to your Word document using putdocx. Don't forget to make sure all the variables are labeled properly. HINT: use 'logistic' instead of 'regress' for your regressions. See extra slides for details. */ *Put your commands here: /* Wrapping up and turning in the assignment (1 pt) */ *Turn in 2 files on the CLE: your do-file and your Word document *Close log here: log close