Due: Sunday 10/18 at 11:59pm. An extra two days have been allotted to reduce time pressure from the project.
This assignment is intended to practice dplyr and
ggplot2 skills.
Intensive care units, or ICUs, are primary spaces in hospitals that are reserved for patients in critical condition. The data below is a random sample of n = 200 ICU patients from a research hospital affiliated with Carnegie Mellon University (CMU).
icu = read.csv("https://nfriedrichsen.github.io/data/icu.csv")
The data dictionary below documents each variable that was recorded:
Part A: Filter the ICU data to include only patients whose visit involves an infection. Then, for the “Age” variable, find the mean, standard deviation, and group size of patients with and without a previous admission in the prior 6 months.
Part B: Considering all ICU patients in these data, add a column to the data set that represents sex-specific Z-score for the variable “HeartRate” of each patient. Note: you should be using different means and standard deviations within each sex to calculate this Z-score.
Part C: Using your results from Part B, recreate the
following ggplot graphic:
Hints: The code used to generate this graph uses
aes(y = after_stat(density)) to put the histograms on the
density scale, and position = "identity" to allow them to
overlap rather than stack. The graphics parameter alpha was
used to provide partial transparency.
Using the icu data, recreate the following figure. Then
briefly describe what this graph shows us about potential relationships
between variables.
Hints: There is a filter using the Previous variable so no previous admits are included.
Pick three (3) variables from this data set, two (2) of which must be variables not used in the previous two questions of this assignment. Make a polished graphic that displays the relationship between these variables, justify your particular graphic choice and modifications, and briefly describe what we have learned from the graph.