```
# install.packages(c("ggplot2","ggdist"))
# remotes::install_github("lbelzile/hecedsm")
data(JZBJG22_E2, package = "hecedsm")
library(ggplot2)
library(ggdist)
ggplot(data = JZBJG22_E2,
mapping = aes(x = condition, group = order, y = conf_dying)) +
::stat_halfeye(adjust = .5, width = .3, .width = c(0.5, 1)) +
ggdist::stat_dots(side = "left", dotsize = .4, justification = 1.05, binwidth = .1) +
ggdistfacet_grid(~order) +
labs(y = "", subtitle = "confidence in landing without dying") +
theme_classic()
```

# Problem set 5

Complete this task individually

**Submission information**: please submit on ZoneCours

- a PDF report
- your code

We consider data from Experiment 2 of Jordan et al. (2022), who measured the confidence of participants on their ability to land successfully a plane if the pilot was incapacitated, after they were exposed to a trivially uninformative 3 minute video of a pilot landing a plane, but filmed in such a way that it was utterly useless. The authors pre-registered a comparison between experimental conditions `video`

vs `no video`

, and found that people watching the video answered higher for the question “How confident are you that you would be able to land the plane without dying”, but there was no discernible effect for “How confident are you that you would be able to successfully land the plane as well as a pilot could”, contrary to expectations. They found that the order in which the questions were asked (`order`

, either pilot first, or dying first) changed the response.

The database in package `hecedsm`

in **R** is labelled `JZBJG22_E2`

. You can also download the SPSS database via this link.

- A dataset is said to be
*balanced*if there are the same number of people in each experimental condition. Are the data balanced over`condition`

and`order`

? Justify your answer. - Plot the response variables using a suitable graph (e.g., half-violin or density plot), for each of the four conditions. Comment on the repartition of the scores along the scale.
- Using Levene’s test, check whether the variance in each subgroup is the same.
- Perform the two-way analysis of variance for both
`conf_dying`

and`conf_pilot`

and report the null and alternative hypotheses, the test statistic, the \(P\)-value and the conclusion of the test. - For each response variable
`conf_dying`

and`conf_pilot`

, perform follow tests. If the interaction is significant, compute simple effects and 95% confidence intervals for the difference in score for`video`

conditions. Otherwise, compute marginal effects.

*Hint*: to create a pretty plot in **R**, try the following:

## References

*Royal Society Open Science*,

*9*(3), 211977. https://doi.org/10.1098/rsos.211977