I've fitted the following model
models_list_1 <- dataset_long %>%
group_by(FEATURE) %>%
do(
fit = lmerTest::lmer(
RESPONSE ~ TREATMENT * SESSION +
(1 | SUBJECT),
data = .
)
) %>%
pull(fit) %>%
lapply(
function(x)
summary(x)$coefficients
) %>%
setNames(
unique(dataset_long$FEATURE)
)
and extracted the pairwise stastistics as follows
md <- dataset_long %>%
group_by(FEATURE) %>%
do(
fit = lmerTest::lmer(
RESPONSE ~ TREATMENT * SESSION +
(1 | SUBJECT),
data = .
)
) %>%
pull(fit) %>%
lapply(
function(m)
lsmeans(
m,
pairwise ~ TREATMENT * SESSION,
adjust = "tukey"
)
)
If I would like to reprocude iteratively (for each of Features variable included into the dataset below) a kind of boxplots graph
where in the place of time reported into the example, I will have the three different sessions of my dataset (reported below will appear) and for each sessions some multiple pairwise comparisons among **the three treatments reported below into the dataset) what am I supposed to do? Which and how I should set an iterative function for reporting the bar of significant difference?
Thanks in advance
Here the dataset
library(tidyr)
set.seed(123)
data <- expand.grid(
SUBJECT = 1:50,
SESSION = c("SessionA", "SessionB", "SessionC"),
TREATMENT = c("TRT-A", "TRT-B", "CTRL"),
FEATURE = paste0("Feature", 1:13)
) %>%
mutate(
SUBJECT = as.character(SUBJECT),
CLUSTER = "G1",
RESPONSE = round(runif(n(), 3, 10), 2)
) %>%
select(SUBJECT, CLUSTER, SESSION, TREATMENT, FEATURE, RESPONSE)
برچسب:
نویسنده: استخدام کار