# 2 Example

semnova is a package intended for latent RM-ANOVA. In the following, we will download a publicly available dataset by Qu et al. (2015) and perform latent RM-ANOVA on a subset of the data.

## 2.1 Getting the Data

The data set can be downloaded from the PLoS ONE website. We use the openxlsx package for importing the data and the tidyverse collection (Wickham et al., 2019) for further data manipulations.

if (!require("openxlsx", character.only = T)) {
install.packages("openxlsx")
library(openxlsx)
}

if (!require("tidyverse", character.only = T)) {
install.packages("tidyverse")
library(tidyverse)
}

as_tibble()

## 2.2 Introducing the Data

Let’s briefly introduce the study conducted by Qu et al. (2015). The authors investigated a bystander effect in a virtual classroom setting. In particular, participants first witnessed virtual students answering questions from a teacher in a training for spoken English. The participants afterwards answered questions themselves. During both parts of the experiment, virtual students (bystanders) whispered and commented on the virtual speaker and the human speaker, respectively. The whispering was either positive or negative. This resulted in a two by two within subject repeated measures design. Every participant received every condition. The relevant sub scale used in our analysis is the virtual students’ performance. We only use two items from this sub scale measuring attitudes towards the virtual bystanders and the performance of the virtual bystanders on an 11-point scale reaching from 0 (very bad) to 11 (very good).

A graphical illustration of these items can be found in Figure 2.1

## 2.3 Preparing the Data

The dataset contains a lot of variables. In the next step, we select only the relevant variables.

d_wide <- d_raw %>%
select(ID, S1PP:S2NN)

d_wide
## # A tibble: 26 x 9
##       ID   S1PP   S1NP   S1PN    S1NN   S2PP  S2NP   S2PN    S2NN
##    <dbl>  <dbl>  <dbl>  <dbl>   <dbl>  <dbl> <dbl>  <dbl>   <dbl>
##  1     1  0.913 0.177  -0.927 -0.927   0.913 0.177 -0.927 -0.927
##  2     2  0.752 1.56    0.128 -1.81    0.565 0.939 -0.246 -2.12
##  3     3  0.238 0.238  -1.32   0.0275  0.660 0.238 -1.49  -0.689
##  4     4 -1.54  1.47    1.09   1.60   -0.552 1.09   0.655  1.52
##  5     5 -0.269 0.120  -0.269  0.120  -0.269 0.120 -0.269  0.509
##  6     6  0.463 0.0686  0.108  0.858   0.463 0.858  0.463  0.0686
##  7     7  1.10  0.707  -0.701 -1.49    0.663 0.179 -0.657 -0.657
##  8     8  0.200 0.777   0.392  0.585  -0.665 0.873 -0.665  1.07
##  9     9  1.88  0.356   0.297  0.297   1.47  1.17  -0.287 -0.521
## 10    10  0.600 1.44    0.676  0.216   0.753 0.753  0.830 -0.168
## # … with 16 more rows