library(ggplot2)ggplot(d) +aes(x = trt, y = y, color = roi) +geom_jitter(width =0.2, height =0)
Summary of y grouped by trt.
tapply(d$y, d$trt, summary)
$`0`
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.02821 2.73509 3.82543 3.67880 4.73462 6.79213
$`1`
Min. 1st Qu. Median Mean 3rd Qu. Max.
-0.4181 3.2678 4.2715 4.2853 5.2978 8.8127
Multilevel Quantile Model
Model the 0.75 quantile (ie, 75th percentile) as a function of treatment, with a random intercept for the id/ln/roi group. To model a different quantile, change the tau argument.
library(lqmm)fit.lqmm <-lqmm(y ~ trt, random =~1 , group = id_ln_roi, data = d, tau =0.75)summary(fit.lqmm)