Hi,
Sorry for the simple question, but I don't seem to be able to wrap my head around it.
I am working on an experiment where the effect of two substances (substances A and B) are assessed on a specific tissue dissolving. The weight of the tissue was assessed in five different time points (0, 24 hour, 48 hour, 72 hour, 96 hour), and four replicates were used for each treatment group. I am using a linear mixed-effects model (i.e., Weight ~ Time * Treatment + (Time|Sample)) in R to assess the effect of the substances on the tissue dissolving. The problem is, looking at the data, it is clearly observable that treatment A dissolves the tissue much faster and the weight quickly decreases. However, looking at the summary of the model, the coefficient for treatment A is positive!
It is my understanding that since the weights are lower in group A at every time point after the time zero, the coefficients should be negative. Can anyone kindly help me understand whether I am doing something wrong in fitting the model or my interpretation of the coefficient is wrong?
Note that for the samples to be comparable, for each sample, the tissue weights are entered as the percentages of the initial weight of the tissue in that sample.
Thanks in advance for your help.
Sample code (you can see that the coefficient for treatment A is about 8):
library(lme4)
library(lmerTest)
samp.dat <- data.frame(Weight=c(100,54,51,36,17,100,59,52,32,0,100,56,53,25,15,100,56,53,34,17,100,59,60,73,75,100,63,66,73,75,100,60,61,69,74,100,67,73,82,85),
Time = rep(c(0,24,48,72,96),8),
Sample = rep(c("A1","A2","A3","A4","B1","B2","B3","B4"), each = 5),
Treatment = factor(rep(c("A","B"), each = 20), levels = c("B","A")))
mod <- lmer(Weight ~ Time * Treatment + (Time|Sample), data = samp.dat)
summary(mod)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Weight ~ Time * Treatment + (Time | Sample)
Data: samp.dat
REML criterion at convergence: 305.3
Scaled residuals:
Min 1Q Median 3Q Max
-1.7194 -0.9196 0.1711 0.6202 1.5012
Random effects:
Groups Name Variance Std.Dev. Corr
Sample (Intercept) 0.000e+00 0.000e+00
Time 8.176e-13 9.042e-07 NaN
Residual 1.367e+02 1.169e+01
Number of obs: 40, groups: Sample, 8
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 82.45000 4.52762 36.00000 18.210 < 2e-16 ***
Time -0.13958 0.07702 36.00000 -1.812 0.0783 .
TreatmentA 8.05000 6.40303 36.00000 1.257 0.2168
Time:TreatmentA -0.69375 0.10892 36.00000 -6.369 2.24e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) Time TrtmnA
Time -0.816
TreatmentA -0.707 0.577
Tim:TrtmntA 0.577 -0.707 -0.816
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
I found this tutorial relevant for your study: https://rpubs.com/alecri/review_longitudinal
lmer(Weight ~ Time*Treatment + (1 | Sample), data = samp.dat)
might be more appropriate?The treatment alone does nothing unless you give it time to work. Time alone does nothing unless you administer a treatment. Makes sense to me.
Thank you very much for your comment.
I am not sure what you mean though since the model I used is very similar to what you recommended. The only difference is that I also included a random slope for time in each sample, which I think would be more appropriate, and in both cases, the estimate for the treatment A is identical (and positive). I assume I am interpreting the coefficients incorrectly. Any thoughts?