I am trying to figure out how to analyze mixed-effect model («lme4» package, lmer function in R). Due to lack of experience, I have some questions that I would be grateful for help with. Currently I am analyzing the dynamic of substance concentration in different patients during the 6 days. As my sample has many missed values, and data are paired, it seems that mixed-effect model is the only suitable analysis here. Questions: 1. Can I perform the analysis considering the fact that the number of observations varies significantly at different time points? 2. Since the assumption of residuals normality is not met, I had to perform the Box-Cox transformation and analyzed the transformed data. After that qq plot looks much better. However, I still see a slight heterogeneity in the variance of the residuals (plot(mod_2)). Should I be concerned about that? 3. It is important for me to get first the omnibus test result for the main effect (day), not the significance of difference of each factor level vs reference category. Therefore, I first enter this predictor as an "integer". I suppose that this is not entirely correct. How can I assess the significance of a fixed effect? 4. Before doing pairwise comparisons, I change the variable type “day” and “patient” into “factor” variable, otherwise I cannot get the results of pairwise comparisons. Is this okay? I would really appreciate any help.
Code: library(lme4) library(lmerTest) library(ggplot2) library(MASS) library(multcomp) R4 <- read.table(file = 'data/R4.csv', sep = ';', dec = ",", header = T) str(R4) names(R4)[names(R4) == "п.їconc"] <- "conc" str(R4) mod_1 <- lmer(conc ~ day + (1 | patient), data=R4) summary(mod_1) qqnorm(resid(mod_1)) qqline(resid(mod_1)) b=boxcox(conc ~ day, data = R4) lambda <- b$x[which.max(b$y)] mod_2 <- lmer(((conc^lambda - 1)/lambda) ~ day + (1 | patient), data=R4) qqnorm(resid(mod_2)) qqline(resid(mod_2)) plot(mod_2) summary(mod_2) R4$day <- as.factor(R4$day) R4$patient <- as.factor(R4$patient) mod_2 <- lmer(((conc^lambda - 1)/lambda) ~ day + (1 | patient), data=R4) summary(glht(mod_2, linfct = mcp(day = "Tukey")), test = adjusted("BY"))