Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSTexercises/09-Prelude-to-modeling/Q09-101.Rmd #29

Open
homerhanumat opened this issue Jan 11, 2025 · 0 comments
Open

LSTexercises/09-Prelude-to-modeling/Q09-101.Rmd #29

homerhanumat opened this issue Jan 11, 2025 · 0 comments

Comments

@homerhanumat
Copy link

Parts D and E belong in a later chapter. If you want students to investigate further after part B, maybe something like this:

## More on Nurse Gilbert

How might we look at the data graphically?  The main tool we have in this course is `point_plot()`, but for a point-plot we need the y-axis variable to be numerical.  The function `zero_one()` cn be used to convert a categorical variable to a numerical variable that has the value 1 for a selected level of the categorical varialble and 0 for all other levels.  Let's use it here to create a new variable called `death_num` that is 1 if there was a death, 0 if there was no death:

```{r}
Gilbert2 <-
  Gilbert |> 
  mutate(death_num = zero_one(death, one = "yes"))
knitr::kable(
  Gilbert2 |> head(10),
  caption = "First 10 rows of Gilbert2"
)
```

Now we can make a point-plot:

```{r}
Gilbert2 |> 
  point_plot(
    death_num ~ gilbert
  )
```

From this plot alone, it's hard to see whether there is difference in the proportion of deaths when Gilbert was on-duty vs. off-duty.  However, we can ask for  model-annotation:

```{r}
Gilbert2 |> 
  point_plot(
    death_num ~ gilbert,
    annot = "model"
  )
```


The blue regions indicate the indicate the ranges of plausible values for the *probability* of death, when Gilbert was on-duty vs. off-duty.

Do you believe that the data provide strong evidence that a death was more probable when Gilbert was on duty?  What feature(s) of the plot led you to your answer?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant