Hello,
I have a question regarding Linear Mixed-Effects Models (lme). The question
has been asked before, but now I've re-stated it in accordance to previous
reply to make it clearer.
My topic question is not complementary, however it will hopefully be clearer
when reading through text below.
The data matrix looks like this, where two outcome variables, FeedingTime
and FeedingWithPrep are the same for group "a", but differ for group "b".
For group "b" I add extra time needed for preparing (only group "b" needs
preparing)
* Group
FeedingTime
FeedingWithPrep
b 180 276 b 190 365 b 170 226 b 200 426 b 210 406 b 220 446 b 250 484 b 270
484 b 150 365 b 290 484 b 300 484 b 275 484 a 100 100 a 90 90 a 50 50 a 110
110 a 40 40 a 75 75 a 85 85 a 90 90 a 115 115*
I look at whether there is a difference in the effect of weight (gram)
between two diets ("a" and "b") on feeding time. Place is random effect (5
different locations) for both of this outcome variables (Feeding Time and
FeedingWithPrep).
The linear models fitted to these 2 outcome variables have the same
estimates for group "a" (the intercept and Gramm), which makes sense because
the group "a" data is unchanged. The estimates including preparing time for
group "b" are different. But the mixed model, which includes a random
effect for the place, is different. The estimates for group "a" are altered,
even though the dependent variable is the same in either case, see below.
Could it be that the random place effect "ranges across" both groups "a" and
"b", so it is only natural that the estimates for both groups would be
affected? Hence, place is apparently not completely independent of diet in
the realization of the sample, so the intercept and the estimate for Gram
are affected slightly.
1a)
> lmfit1<-lm(log10(FeedingTime) ~ log10(Gram)*Diet,data=diet)
1b))
> lmfit2<-lm(log10(FeedingtimeWithPrep) ~ log10(Gram)*Diet,data=diet)
1a)
> summary(lmfit1)
Call:
lm(formula = log10(FeedingTime) ~ log10(Gram) * Diet, data = diet)
Residuals:
Min 1Q Median 3Q Max
-0.23163 -0.03347 0.01312 0.05164 0.12056
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.2942 0.4297 0.685 0.50277
log10(Gram) 1.1833 0.3156 3.750 0.00160 **
Dietb 1.1472 0.5302 2.164 0.04501 *
log10(Gram):Dietb -0.6922 0.3578 -1.935 0.06983 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.08699 on 17 degrees of freedom
Multiple R-squared: 0.901, Adjusted R-squared: 0.8836
F-statistic: 51.59 on 3 and 17 DF, p-value: 9.492e-09
1b)
> summary(lmfit2)
Call:
lm(formula = log10(FeedingtimeWithPrep) ~ log10(Gram) * Diet,
data = diet)
Residuals:
Min 1Q Median 3Q Max
-0.2316266 -0.0003216 0.0001792 0.0058846 0.1205559
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.2942 0.3512 0.838 0.413840
log10(Gram) 1.1833 0.2579 4.588 0.000262 ***
Dietb 1.0359 0.4333 2.391 0.028665 *
log10(Gram):Dietb -0.4902 0.2924 -1.676 0.112005
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.0711 on 17 degrees of freedom
Multiple R-squared: 0.9698, Adjusted R-squared: 0.9645
F-statistic: 182 on 3 and 17 DF, p-value: 4.069e-13
2a)
> lmefit1<-lme(log10(FeedingTime) ~
log10(Gram)*Diet,random=~1|Place,data=diet)
2b)
> lmefit2<-lme(log10(FeedingtimeWithPrep) ~
log10(Gram)*Diet,random=~1|Place,data=diet)
2a)
> summary(lmefit1)
Linear mixed-effects model fit by REML
Data: diet
AIC BIC logLik
-24.12282 -19.12354 18.06141
Random effects:
Formula: ~1 | Place
(Intercept) Residual
StdDev: 0.0505571 0.07350342
Fixed effects: log10(FeedingTime) ~ log10(Gram) * Diet
Value Std.Error DF t-value p-value
(Intercept) 0.3111653 0.3737451 13 0.832560 0.4201
log10(Gram) 1.1664078 0.2735981 13 4.263216 0.0009
Dietb 1.1580016 0.5148035 13 2.249405 0.0425
log10(Gram):Dietb -0.6904469 0.3321850 13 -2.078501 0.0580
Correlation:
(Intr) lg10(G) Dietb
log10(Gram) -0.996
Dietb -0.740 0.726
log10(Gram):Dietb 0.833 -0.826 -0.985
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.2608248 -0.3226060 -0.1256394 0.5658181 1.6808270
Number of Observations: 21
Number of Groups: 5
2b)
> summary(lmefit2)
Linear mixed-effects model fit by REML
Data: diet
AIC BIC logLik
-29.98107 -24.98179 20.99054
Random effects:
Formula: ~1 | Place
(Intercept) Residual
StdDev: 0.03568998 0.06341113
Fixed effects: log10(FeedingtimeWithPrep) ~ log10(Gram) * Diet
Value Std.Error DF t-value p-value
(Intercept) 0.3001162 0.3210428 13 0.934817 0.3669
log10(Gram) 1.1760924 0.2352253 13 4.999855 0.0002
Dietb 1.0937006 0.4302214 13 2.542181 0.0246
log10(Gram):Dietb -0.5178826 0.2805392 13 -1.846026 0.0878
Correlation:
(Intr) lg10(G) Dietb
log10(Gram) -0.996
Dietb -0.757 0.746
log10(Gram):Dietb 0.845 -0.840 -0.986
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.94950911 -0.19998787 -0.11069540 0.09370866 1.65930147
Number of Observations: 21
Number of Groups: 5
[[alternative HTML version deleted]]