I’m trying to do a repeated measures ANOVA. Lets say the data is as follows
julia> using CategoricalArrays, DataFrames, Random
julia> Random.seed!(1)
julia> df = DataFrame(
id = categorical(repeat(1:2; inner=6)),
a = categorical(repeat(1:3, inner=2, outer=2)),
b = categorical(repeat(1:2, 6)),
value = round.(rand(Float64, 12), digits=1)
)
12×4 DataFrame
Row │ id a b value
│ Cat… Cat… Cat… Float64
─────┼───────────────────────────
1 │ 1 1 1 0.2
2 │ 1 1 2 0.3
3 │ 1 2 1 0.3
4 │ 1 2 2 0.0
5 │ 1 3 1 0.5
6 │ 1 3 2 0.2
7 │ 2 1 1 1.0
8 │ 2 1 2 1.0
9 │ 2 2 1 0.3
10 │ 2 2 2 1.0
11 │ 2 3 1 0.6
12 │ 2 3 2 0.4
and lets say I want to have the p-values for different effects such as a
, b
and a*b
. I’ve been looking at the packages mentioned in ANOVA Tests in Julia? - #61 by BioTurboNick, but wasn’t able to reproduce work that I’m trying to reproduce.
For the sake of generality, I would prefer solving this problem by just using GLM.jl, which should be possible according to Repeated Measures and Mixed Models and Common statistical tests are linear models (or: how to teach stats). Also, there is a mention of ANOVA in the GLM documentation for ftest.
The main problem that I have is how to deal with the repeated measures parts in combination with the different effects.
EDIT: I think that the solution is to use the MixedModels package (Repeated measures 2 way ANOVA - #2 by mkborregaard).
EDIT2: No, MixedModels is not it because I need F-values and GLM.ftest doesn’t work on MixedModels.