Skip to content

Commit

Permalink
removing an exercise from supp-a06 for time
Browse files Browse the repository at this point in the history
  • Loading branch information
lucylgao committed Sep 27, 2023
1 parent a499699 commit 4f81bcc
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 28 deletions.
8 changes: 4 additions & 4 deletions content/notes/supp-a06-solution.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ This broadly tells the same story as the summaries we calculated last week, but

Let's do some digging to see if there are other variables that we would like to adjust for, when comparing the FEV of smokers to non-smokers.

### Exercise 3
### Exercise 2

Last week, we found that the youngest patient who smokes is 9, suggesting that there is a difference in the age distribution among smokers and non-smokers. Make a plot that compares these two distributions.

Expand All @@ -65,7 +65,7 @@ ggplot(fev_tbl, aes(fill=smoke)) +

Again, we see that the smokers are overall older than the non-smokers.

### Exercise 4
### Exercise 3

We think that age should be related to height, which in turn should be related to FEV. Let's investigate that more systematically now with plotting.

Expand All @@ -84,7 +84,7 @@ ggplot(fev_tbl, aes(x = age, y = height, colour=sex)) +

We see that the within-sex trend is similar: height is linear-ish at younger ages, and flat-ish at older ages. Boys wind up taller at older ages.

Then, make a scatterplot of FEV versus height.
We will then make a scatterplot of FEV versus height.

```{r}
ggplot(fev_tbl, aes(x = height, y = fev)) +
Expand All @@ -101,7 +101,7 @@ We see that taller participants generally have higher FEV.

Now that we know that the smokers are older and bigger and have higher FEV, let's look at the relationship between FEV and smoking status *adjusted* for height.

### Exercise 5
### Exercise 4

Make a scatterplot of FEV versus height, with points coloured by smoking status.

Expand Down
14 changes: 7 additions & 7 deletions content/notes/supp-a06-solution.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ <h3>Exercise 1</h3>
<div id="informating-gathering-what-might-we-want-to-adjust-for" class="section level2">
<h2>Informating gathering: what might we want to adjust for?</h2>
<p>Let’s do some digging to see if there are other variables that we would like to adjust for, when comparing the FEV of smokers to non-smokers.</p>
<div id="exercise-3" class="section level3">
<h3>Exercise 3</h3>
<div id="exercise-2" class="section level3">
<h3>Exercise 2</h3>
<p>Last week, we found that the youngest patient who smokes is 9, suggesting that there is a difference in the age distribution among smokers and non-smokers. Make a plot that compares these two distributions.</p>
<pre class="r"><code>ggplot(fev_tbl, aes(fill=smoke)) +
geom_bar(aes(x = age, y = after_stat(prop))) +
Expand All @@ -52,8 +52,8 @@ <h3>Exercise 3</h3>
<p><img src="/notes/supp-a06-solution_files/figure-html/unnamed-chunk-3-1.png" width="672" /></p>
<p>Again, we see that the smokers are overall older than the non-smokers.</p>
</div>
<div id="exercise-4" class="section level3">
<h3>Exercise 4</h3>
<div id="exercise-3" class="section level3">
<h3>Exercise 3</h3>
<p>We think that age should be related to height, which in turn should be related to FEV. Let’s investigate that more systematically now with plotting.</p>
<p>First, make a plot with two panels: one that has a scatterplot of height versus age for the female patients, and one that has a scatterplot of height versus age for the male patients.</p>
<pre class="r"><code>ggplot(fev_tbl, aes(x = age, y = height, colour=sex)) +
Expand All @@ -66,7 +66,7 @@ <h3>Exercise 4</h3>
theme_bw()</code></pre>
<p><img src="/notes/supp-a06-solution_files/figure-html/unnamed-chunk-4-1.png" width="672" /></p>
<p>We see that the within-sex trend is similar: height is linear-ish at younger ages, and flat-ish at older ages. Boys wind up taller at older ages.</p>
<p>Then, make a scatterplot of FEV versus height.</p>
<p>We will then make a scatterplot of FEV versus height.</p>
<pre class="r"><code>ggplot(fev_tbl, aes(x = height, y = fev)) +
geom_jitter(width=0.2, alpha = 0.75) +
ggtitle(&quot;FEV versus height&quot;) +
Expand All @@ -80,8 +80,8 @@ <h3>Exercise 4</h3>
<div id="smoking-and-fev-adjusted-for-height" class="section level2">
<h2>Smoking and FEV, adjusted for height</h2>
<p>Now that we know that the smokers are older and bigger and have higher FEV, let’s look at the relationship between FEV and smoking status <em>adjusted</em> for height.</p>
<div id="exercise-5" class="section level3">
<h3>Exercise 5</h3>
<div id="exercise-4" class="section level3">
<h3>Exercise 4</h3>
<p>Make a scatterplot of FEV versus height, with points coloured by smoking status.</p>
<pre class="r"><code>ggplot(fev_tbl, aes(x = height, y = fev, colour=smoke)) +
geom_jitter(width=0.2, alpha = 0.75) +
Expand Down
19 changes: 12 additions & 7 deletions content/notes/supp-a06.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This broadly tells the same story as the summaries we calculated last week, but

Let's do some digging to see if we can root out some potential confounders.

### Exercise 3
### Exercise 2

Last week, we found that the youngest patient who smokes is 9, suggesting that there is a difference in the age distribution among smokers and non-smokers. Make a plot that compares these two distributions.

Expand All @@ -51,22 +51,27 @@ Last week, we found that the youngest patient who smokes is 9, suggesting that t

Again, we see that the smokers are overall older than the non-smokers.

### Exercise 4
### Exercise 3

We think that age should be related to height, which in turn should be related to FEV. Let's investigate that more systematically now with plotting.

First, make a plot with two panels: one that has a scatterplot of height versus age for the female patients, and one that has a scatterplot of height versus age for the male patients.
Here's a plot with two panels: one that has a scatterplot of height versus age for the female patients, and one that has a scatterplot of height versus age for the male patients.

```{r}
# FILL IN HERE
```

We see that the within-sex trend is similar: height is linear-ish at younger ages, and flat-ish at older ages. Boys wind up taller at older ages.

Then, make a scatterplot of FEV versus height.
We will then make a scatterplot of FEV versus height.

```{r}
# FILL IN HERE
ggplot(fev_tbl, aes(x = height, y = fev)) +
geom_jitter(width=0.2, alpha = 0.75) +
ggtitle("FEV versus height") +
ylab("FEV (l/s)") +
xlab("Height (inches)") +
theme_bw()
```

We see that taller participants generally have higher FEV.
Expand All @@ -75,12 +80,12 @@ We see that taller participants generally have higher FEV.

Now that we know that the smokers are older and bigger and have higher FEV, let's look at the relationship between FEV and smoking status *adjusted* for height.

### Exercise 5
### Exercise 4

Make a scatterplot of FEV versus height, with points coloured by smoking status.

```{r}
# FILL IN HERE
```

Based on this plot, it seems like the FEV of smokers and non-smokers *of the same height* is is pretty similar.
Based on this plot, it seems like the FEV of smokers and non-smokers *of the same height* is pretty similar.
26 changes: 16 additions & 10 deletions content/notes/supp-a06.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,36 @@ <h3>Exercise 1</h3>
<div id="searching-for-potential-confounders" class="section level2">
<h2>Searching for potential confounders</h2>
<p>Let’s do some digging to see if we can root out some potential confounders.</p>
<div id="exercise-3" class="section level3">
<h3>Exercise 3</h3>
<div id="exercise-2" class="section level3">
<h3>Exercise 2</h3>
<p>Last week, we found that the youngest patient who smokes is 9, suggesting that there is a difference in the age distribution among smokers and non-smokers. Make a plot that compares these two distributions.</p>
<pre class="r"><code># FILL IN HERE</code></pre>
<p>Again, we see that the smokers are overall older than the non-smokers.</p>
</div>
<div id="exercise-4" class="section level3">
<h3>Exercise 4</h3>
<div id="exercise-3" class="section level3">
<h3>Exercise 3</h3>
<p>We think that age should be related to height, which in turn should be related to FEV. Let’s investigate that more systematically now with plotting.</p>
<p>First, make a plot with two panels: one that has a scatterplot of height versus age for the female patients, and one that has a scatterplot of height versus age for the male patients.</p>
<p>Here’s a plot with two panels: one that has a scatterplot of height versus age for the female patients, and one that has a scatterplot of height versus age for the male patients.</p>
<pre class="r"><code># FILL IN HERE</code></pre>
<p>We see that the within-sex trend is similar: height is linear-ish at younger ages, and flat-ish at older ages. Boys wind up taller at older ages.</p>
<p>Then, make a scatterplot of FEV versus height.</p>
<pre class="r"><code># FILL IN HERE</code></pre>
<p>We will then make a scatterplot of FEV versus height.</p>
<pre class="r"><code>ggplot(fev_tbl, aes(x = height, y = fev)) +
geom_jitter(width=0.2, alpha = 0.75) +
ggtitle(&quot;FEV versus height&quot;) +
ylab(&quot;FEV (l/s)&quot;) +
xlab(&quot;Height (inches)&quot;) +
theme_bw()</code></pre>
<p><img src="/notes/supp-a06_files/figure-html/unnamed-chunk-5-1.png" width="672" /></p>
<p>We see that taller participants generally have higher FEV.</p>
</div>
</div>
<div id="smoking-and-lung-function-a-more-nuanced-look" class="section level2">
<h2>Smoking and lung function: a more nuanced look</h2>
<p>Now that we know that the smokers are older and bigger and have higher FEV, let’s look at the relationship between FEV and smoking status <em>adjusted</em> for height.</p>
<div id="exercise-5" class="section level3">
<h3>Exercise 5</h3>
<div id="exercise-4" class="section level3">
<h3>Exercise 4</h3>
<p>Make a scatterplot of FEV versus height, with points coloured by smoking status.</p>
<pre class="r"><code># FILL IN HERE</code></pre>
<p>Based on this plot, it seems like the FEV of smokers and non-smokers <em>of the same height</em> is is pretty similar.</p>
<p>Based on this plot, it seems like the FEV of smokers and non-smokers <em>of the same height</em> is pretty similar.</p>
</div>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/notes/supp-a06_files/figure-html/unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/notes/supp-a06_files/figure-html/unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/notes/supp-a06_files/figure-html/unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4f81bcc

Please sign in to comment.