3
$\begingroup$

Just on principle, do you think it would make sense to make linear regression models for each individual in a study and treat replicates as data points? I don't mean reporting p-values or anything like that, just for visualization purposes.

Specifically, it'd be a comparison of subjects exposed to treatments, say treatment1 and treatment2 vs. their basal states. Could I show plots for each subject's "trajectory" from basal state to treatment1 to treatment2?

The actual analysis I would do is a linear mixed-effects model, but I think it could be useful to be able to show how each subject individually responded to the treatments as well.

Edit:

I was thinking something like this:

enter image description here

Do you think this is useful or is it misleading? An important problem is that not all subjects were exposed to all the treatments, so some of them only have 2 observations with 2 replicates each. I could maybe add the replicates as poits in the regression as well? Just to see how they varied.

Edit 2:

This is just made up data, but I just realized that if two treatments have opposite effects, the regression would not show that. So maybe my best bet is to just plot each treatment vs the basal state and forget about the regression?

$\endgroup$
3
  • 2
    $\begingroup$ Do you have an example you could post using some data or simulated data? I’m struggling to understand what you want to plot. $\endgroup$
    – Dave
    Commented Nov 30, 2023 at 11:36
  • 4
    $\begingroup$ Plotting the data is always a good idea. Please show us the plots and describe your data and research questions. $\endgroup$ Commented Nov 30, 2023 at 11:37
  • $\begingroup$ As several have noted, of course this is not only possible but it is an approach at the heart of many iterative, approximating routines. The question remains is it useful? Iow, depending on the sample size, at what point does it become an impractical, overwhelming burden to review results from dozens, hundreds, much less thousands of unaggregated mini-regressions? $\endgroup$
    – user78229
    Commented Nov 30, 2023 at 13:33

1 Answer 1

6
$\begingroup$

To answer your question: yes this is certainly an acceptable thing to do and can do a great job of showing individual differences in random intercepts/slopes. From the original lme4 paper, they construct an XY plot from the lattice package to show how reaction time shifted over time in each subject. I simplify and annotate the code from their R script to make it easier to read:

#### Load Libraries ####
library(lmerTest)
library(lattice)

#### Plot ####
xyplot(Reaction ~ Days | Subject,
       sleepstudy, 
       aspect = "xy",
       type = c("g", "p", "r"),
       xlab = "Days of sleep deprivation",
       ylab = "Average reaction time (ms)")

Shown below, where you can see generally reaction time increases by day, but some subjects actually have either little change or even the opposite effect where the RT diminishes (Subject 335):

enter image description here

Of course in your case there are only two/three time points, but that isn't really an issue. Regarding the point you made here:

Do you think this is useful or is it misleading? An important problem is that not all subjects were exposed to all the treatments, so some of them only have 2 observations with 2 replicates each.

No, this is not misleading. You are in fact showing that information in your plot, hence this provides context about the variation in random effects. Keep in mind that imbalance in the random effects with small sample sizes can affect your inference about them as shown in some simulation studies, so you may need to report that as a limitation in your report. With respect to your other question:

This is just made up data, but I just realized that if two treatments have opposite effects, the regression would not show that. So maybe my best bet is to just plot each treatment vs the basal state and forget about the regression?

The XY plot above shows that this isn't an issue and is in fact common (some slopes may be positive and some may be negative).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.