**Setup cd "/Users/" //modify filepath to your directory capture log close //close any open log files set linesize 120 //increase the linesize (width of the page) helps for formatting the Markdown document clear quietly log using biostat212_assignment3_name.smcl, replace /*using "quietly" will stop print out in your smcl file making a nicer looking .pdf when you use markdown*/ /*** #Biostat 212: 2017 #Assignment 3: Data visualization ## Your Name --- Instructions For each graph, follow the instructions step by step. Include your command under each step. If you get stuck, explore the drop-down menu and copy-paste commands into your .do file. The Stata help files are also useful. Include the final graph in the MarkDoc document. Turn in the docx or pdf you create using MarkDoc. See the first graph (Histogram) for an example ***/ /*** Load the nhanes2 data set from the web ***/ webuse nhanes2 /*** ##HISTOGRAM ***/ /*** Create a histogram of systolic blood pressure (bpsystol) ***/ histogram bpsystol /*** Plot frequency instead of density ***/ histogram bpsystol, frequency /*** Overlay a normal distribution ***/ histogram bpsystol, frequency normal /*** Change the number of bins to 15 ***/ histogram bpsystol, frequency normal bin(15) /*** Change the scheme too (s2mono) ***/ histogram bpsystol, frequency normal bin(15) scheme(s2mono) /*** Display the final plot in your MarkDoc document ***/ img /*** ##BAR PLOT [+10] ***/ /*** Create a bar plot of heart attack ***/ /*** Create and assign a label for (heartatk) 0 = no heart attack 1= heart attack and re-run your bar plot ***/ /*** Now plot mean heart attack over sex ***/ /*** Add diabetes to your plot (mean heart attack and diabetes over sex) ***/ /*** Add a legend _hint: legend( label(1 "xyz") label(2 "xyz") )_ ***/ /*** Add an informative title and a note with the data source _hint: note("Source: NHANES")_ ***/ /*** Produce the same figure, but only for people 70 years old and older add a subtitle describing the sub-population ***/ /***change the color of the heart attack bar to black and the color of the diabetes bar to gray _hint: bar(1, color(black)) bar(2, color(gray)) _ ***/ /*** Display the final plot in your markDoc document ***/ /*** ##SCATTER PLOT [+10] ***/ /*** Create a scatter plot of systolic blood pressure and age ***/ /*** Change the point size to very tiny and the color to gray ***/ /*** Add a black dashed linear fit line ***/ /*** Change the line width to thick ***/ /*** Turn off the legend ***/ /*** Add a y-axis title (Systolic blood pressure) ***/ /*** Change the scheme to (s1color) ***/ /*** Display the final plot in your MarkDoc document ***/ /*** ##YOUR CHOICE [+15] Visualize 2 or 3 variables in the dataset in a single plot. Use any type of plot. Add clear labels to make it easy for the reader to understand your plot. Add a title and a note with the data source. Consider using a scheme. Include the code and the plot in your MarkDoc document ***/ qui log close //close log (quietly so it won't appear in markdown document /*The following command creates a PDF or word document from your log file. Make sure the name of the file after the word markdown matches the name of your log file If you have an issue loading graphs into your PDF, change the export format to docx*/ markdoc biostat212_assignment3_name, replace export(docx) date