set.seed(2022)
<- 200
n <-
data_2x2 tibble(
x1 = sample(0:1, size = n, replace = TRUE),
x2 = sample(0:1, size = n, replace = TRUE),
score = 5 + 0.5 * x1 - 0.6 * x2 + 0.6 * x1 * x2 + rnorm(n = n, sd = 1),
condition = factor(x1, levels = 0:1, labels = c("control", "training")),
gender = factor(x2, levels = 0:1, labels = c("woman", "man"))
|>
) select(score, condition, gender) |>
mutate(subject = row_number(), .before = 1)
|>
data_2x2 head(100) |>
kable() |>
kable_styling() |>
scroll_box(height = "360px")
subject | score | condition | gender |
---|---|---|---|
1 | 5.876475 | training | woman |
2 | 4.805460 | control | woman |
3 | 3.384664 | training | woman |
4 | 4.086933 | control | woman |
5 | 4.749709 | control | man |
6 | 5.905577 | training | woman |
7 | 6.005326 | training | man |
8 | 3.208133 | control | woman |
9 | 4.838511 | training | woman |
10 | 5.127727 | training | woman |
11 | 5.158661 | control | woman |
12 | 4.321588 | control | woman |
13 | 5.582489 | training | man |
14 | 6.743740 | training | woman |
15 | 5.280495 | control | man |
16 | 5.543959 | control | woman |
17 | 4.709095 | training | man |
18 | 4.827145 | control | man |
19 | 6.451114 | training | woman |
20 | 6.320117 | training | man |
21 | 2.589054 | control | man |
22 | 4.720086 | control | woman |
23 | 5.071068 | control | man |
24 | 7.096972 | training | man |
25 | 4.274268 | control | woman |
26 | 6.460575 | training | man |
27 | 6.456440 | training | man |
28 | 6.265848 | control | woman |
29 | 4.763044 | control | woman |
30 | 3.979886 | training | woman |
31 | 5.339553 | control | woman |
32 | 6.895974 | training | woman |
33 | 4.313938 | training | man |
34 | 5.095529 | training | man |
35 | 4.712894 | control | woman |
36 | 5.342586 | control | man |
37 | 4.445261 | training | woman |
38 | 4.342722 | control | woman |
39 | 3.985711 | control | man |
40 | 5.953967 | training | woman |
41 | 3.846046 | control | man |
42 | 5.853868 | training | man |
43 | 5.648286 | training | man |
44 | 5.876512 | training | woman |
45 | 6.506987 | control | woman |
46 | 4.572705 | training | woman |
47 | 4.412859 | control | woman |
48 | 7.958926 | training | woman |
49 | 6.173742 | training | woman |
50 | 5.834424 | training | man |
51 | 6.609042 | control | woman |
52 | 4.384601 | training | woman |
53 | 5.010130 | control | woman |
54 | 3.947642 | control | woman |
55 | 5.933923 | training | woman |
56 | 5.058090 | control | man |
57 | 2.959927 | control | man |
58 | 4.873361 | control | man |
59 | 3.594148 | control | man |
60 | 4.714534 | training | man |
61 | 3.264649 | control | man |
62 | 4.588575 | training | woman |
63 | 5.089966 | control | woman |
64 | 4.163905 | control | man |
65 | 7.127579 | training | woman |
66 | 6.005201 | training | man |
67 | 4.437437 | control | man |
68 | 5.365165 | control | woman |
69 | 4.105399 | training | man |
70 | 5.635135 | control | woman |
71 | 5.022247 | training | woman |
72 | 4.180026 | control | woman |
73 | 6.752384 | training | man |
74 | 4.181650 | training | woman |
75 | 6.044261 | training | man |
76 | 4.213103 | control | man |
77 | 6.115964 | training | woman |
78 | 5.527988 | control | woman |
79 | 5.734455 | training | man |
80 | 5.387702 | training | man |
81 | 4.183703 | training | woman |
82 | 5.163233 | training | woman |
83 | 5.478410 | control | woman |
84 | 3.306088 | control | man |
85 | 6.261406 | control | woman |
86 | 5.536015 | training | woman |
87 | 6.881067 | control | woman |
88 | 4.633545 | training | woman |
89 | 4.505152 | training | woman |
90 | 3.482766 | control | woman |
91 | 5.459823 | training | man |
92 | 3.713462 | training | man |
93 | 6.456246 | training | man |
94 | 4.719504 | control | woman |
95 | 5.088813 | training | woman |
96 | 3.936570 | control | man |
97 | 3.045063 | training | man |
98 | 5.812886 | training | man |
99 | 3.608662 | control | man |
100 | 4.625465 | control | man |