garner-code / PSY2R

translating PSY to R
3 stars 16 forks source link

1. compare each to each and one to many #45

Open MashaPtukha opened 1 week ago

MashaPtukha commented 1 week ago

If you wanted to compare each groups to each other group, for example, and you have several of them, it would be handy to have a way to define the contrasts automatically, not each by hand

MashaPtukha commented 1 week ago

for pairwise: we can just use a function internal to emmeans

library(emmeans) fit <- lm(response ~ treatment, data = your_data) em_means <- emmeans(fit, "treatment") pairwise_contrasts <- contrast(em_means, method = "pairwise")

to be continued