Visualizing lmer and limits [Study As­sess­ment]

Dear Detlew,

» » Blue dot-dashed lines: 90% limits built using 90% CIs for the slope and intercept
» » Red lines: 80-125% acceptance limits
» I must confess that I don't understand what you do here with the last two points.
From my experience: If Detlew does not understand my intentions, the intentions have wrong direction
» Dose dependent 90% limits for what using 90% CIs for the slope and intercept
These are the lines built using lower/upper limits of 90% CIs for both Slope and Intercept.
For now I don't think that's correct, since the final conclusion should be made using slope only. So I removed intercept uncertainty from calculation of 90% CI prediction line.
As Dr.Smith mentioned, 'The estimate of the “intercept” parameter ... with a 90% CI of ... and its between-subject variability are not of interest here'

» Dose dependent acceptance limits .
» Could you please elaborate and enlighten me?
» With simple words please, not with complex sophisticated code.
I tried to reformulate eq4 used for acceptance criteria.
If Beta1 should be less than 1 + ln(Theta2)/ln(r), then what is the PK level in the current dose point which is still acceptable?
From my graph one could see that Dose = 50 is the last acceptable point.

» The prediction area is calculated based on the dose values used in the study. Should it not calculated on interpolated dose values to get more smooth area borders?
Agree!

» And why do you used the prediction interval as a fit visualization? AFAIK is prediction for future observations, but I think we had the goal to visualize the fit of our current observations. So would it not better to use a 90% confidence interval instead?
Stand corrected. I removed CIs for individual observations since it is nonsense here.

library(lme4) library(lmerTest) library(dplyr) library(ggplot2) lowBind <- 0.8 Subj   <- c(1, 2, 4, 5, 6, 4, 5, 6, 7, 8, 9, 7, 8, 9) Dose   <- c(25, 25, 50, 50, 50, 250, 250, 250, 75, 75, 75, 250, 250, 250) Cmax   <- c(64.82, 67.35, 104.15, 143.12, 243.63, 451.44, 393.45,             796.57, 145.13, 166.77, 296.90, 313.00, 387.00, 843.00) resp   <- data.frame(Subj, Dose, Cmax) resp$Subj <- factor(resp$Subj) muddle <- lmer(log(Cmax) ~ log(Dose) + (1|Subj), data=resp, REML = FALSE) coefs <- data.frame(summary(muddle)\$coefficients) DoseSequence <- data.frame(DoseSequence = seq(sort(unique(Dose))[1], max(Dose), length.out = 100)) LinesDF <-   DoseSequence %>%   mutate(Fit =  exp(coefs['(Intercept)','Estimate'] + log(DoseSequence) * coefs['log(Dose)','Estimate']),          LowCI = exp(coefs['(Intercept)','Estimate'] + log(DoseSequence) * (coefs['log(Dose)', 'Estimate'] - qt(1-0.05, coefs['log(Dose)', 'df']) * coefs['log(Dose)', 'Std..Error'])),          UpCI = exp(coefs['(Intercept)','Estimate'] + log(DoseSequence) * (coefs['log(Dose)', 'Estimate'] + qt(1-0.05, coefs['log(Dose)', 'df']) * coefs['log(Dose)', 'Std..Error'])),                     LowLi = exp(coefs['(Intercept)','Estimate'] + log(DoseSequence) * (1+log(lowBind)/log(DoseSequence/min(Dose)))),          UpLi = exp(coefs['(Intercept)','Estimate'] + log(DoseSequence) * (1-log(lowBind)/log(DoseSequence/min(Dose))))          ) ggplot() +   geom_point(data = resp,aes(x = Dose, y = Cmax), size = 3, fill = 'black')+   geom_line(data = LinesDF, aes(x = DoseSequenceFirst, y = Fit), size = 2, color = 'blue', linetype = 'dashed') +   geom_line(data = LinesDF, aes(x = DoseSequenceFirst, y = LowCI), size = 2, color = 'blue', linetype = 'dotdash' ) +   geom_line(data = LinesDF, aes(x = DoseSequenceFirst, y = UpCI), size = 2, color = 'blue', linetype = 'dotdash' ) +   geom_line(data = LinesDF%>%filter(DoseSequence >= sort(unique(Dose))[2]), aes(x = DoseSequence, y = LowLi), size = 2, color = 'red') +   geom_line(data = LinesDF%>%filter(DoseSequence >= sort(unique(Dose))[2]), aes(x = DoseSequence, y = UpLi), size = 2, color = 'red') +   scale_y_continuous(trans = 'log10') +   theme_bw()

Kind regards,
Mittyri