```
data(GK14_S3, package = "hecedsm")
<- GK14_S3 |>
db ::filter(
dplyr!is.na(persp), # exclude missing values
== "young") # only young adults age
```

# Problem set 3

**Submission information**: please submit on ZoneCours

- a PDF report
- your code

following the naming convention `PS3-studentid.extension`

where `studentid`

is replaced with your student ID and `extension`

is the file extension (e.g., `.pdf`

, `.R`

, `.Rmd`

, `.sps`

)

**Instructions**: We consider data collected for Study 3 of Grossmann & Kross (2014) (click the links to download the paper and the Supplementary material). You can access these data directly from **R** from the `hecedsm`

package or download the SPSS data.

If you work with **R**, check out this helper code

Have a quick look at the paper and fit the one way analysis of variance model for the consideration of other’s perspective (`persp`

) scores as a function of experimental condition, restricting attention to the subsample consisting of young adults (20 to 40 years).

- Report the \(F\)-test statistic, the null distribution and the \(p\)-value.
- Provide a conclusion in the context of the study.
- There are missing values (see code output below). One thing to check normally is whether the lack of response is due to the treatment (for example, tasks that are more difficult or longer lead to higher dropout rate). Using the code provided below, inspect the pattern. Do you think there is a cause for concern in the present context?

We next look at model assumptions

- Is the independence assumption plausible in the context?
- How many observations are there in each group (excluding missing values)? Is the number sufficient to reliably estimate the sample mean of each experimental condition and forego normality checks?
- Produce a normal quantile-quantile plot and comment on the distribution of the residuals (check out this response on CrossValidated first).
- Check the equality of variance assumption using a suitable test statistic and report the results.
- Use Welch’s one-way analysis of variance model (
`oneway.test()`

in**R**) and compare the output and the conclusion with that of the usual \(F\)-test.

**Hints and R snippets**

To subset the data, you can use the following commands:

The following code filters out missing values for `persp`

for young adults and shows the counts for each condition:

```
|>
GK14_S3 ::filter(is.na(persp),
dplyr== "young") |>
age ::group_by(condition) |>
dplyr::summarize(count = dplyr::n()) dplyr
```

```
# A tibble: 4 × 2
condition count
<fct> <int>
1 self immersed 3
2 self distanced 3
3 other immersed 3
4 other distanced 2
```

and finally the following code chunk creates box and whiskers plots and overlays the (jittered) data.

```
library(ggplot2) # grammar of graphics
ggplot(data = db,
mapping = aes(x = condition,
y = persp,
color = condition)) +
geom_boxplot() +
geom_jitter()
```

## References

*Psychological Science*,

*25*(8), 1571–1580. https://doi.org/10.1177/0956797614535400