-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheck_effect_size.R
More file actions
49 lines (38 loc) · 1.58 KB
/
check_effect_size.R
File metadata and controls
49 lines (38 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
library(mvtnorm)
library(afex)
library(emmeans)
library(ggplot2)
library(gridExtra)
library(reshape2)
source("ANOVA_design.R")
source("ANOVA_power.R")
#simply repeated effect
design_result <- ANOVA_design(string = "2w",
n = 80,
mu = c(1, 1.4),
sd = 1,
r=0.9,
p_adjust = "none",
labelnames = c("age", "old", "young"))
simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500)
#This should return a Cohen's dz of 0.9844.
#same design, now between effect
design_result <- ANOVA_design(string = "2b",
n = 80,
mu = c(1, 1.4),
sd = 1,
r=0.9,
p_adjust = "none",
labelnames = c("age", "old", "young"))
simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500)
#This should return a Cohen's d of 0.4.
#now again within effect, but r = 0.5
design_result <- ANOVA_design(string = "2w",
n = 80,
mu = c(1, 1.4),
sd = 1,
r=0.5,
p_adjust = "none",
labelnames = c("age", "old", "young"))
simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500)
#This should return a Cohen's dz of 0.4 (because the r = 0.5, same as between)