Hello,
I have a question regarding Linear Mixed-Effects Models (lme). I have
searched help forum, but find it difficult to find an answer on my question.
Probaly there is an easy answer to this, but due to lack of knowledge I can
not understand following :
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). I ran script 1a), so far so good. I get the intercept
and slope for diet "a" and "b". But for diet "b" I also want to add extra
time needed for preparing (only diet "b" needs preparing). Feeding time for
diet "a" is the same, only feeding time for diet "b" increases. I ran script
1b), as expect intercept and slope for diet "b" changes, but why does
intercept and slope for diet "a" change? The feeding time is equal for
diet "a" in both script 1a) and 1b). Then I tried to see what happens when
not control for random effect by using lm, and ran script 2a) and 2b). And
now the intercept and slope for diet "a" is the same for both script
(without and with preparing time for diet "b"). Could the difference be a
result of how the random effect is being calculated for in lme? The
difference is minimal, but I would like to understand why the intercept and
slope for diet "a" changes?
Sorry if my question is too simple.
Regards Cotter
1a)
> lmefit1<-lme(log10(FeedingTime) ~
log10(Gram)*Diet,random=~1|Place,data=diet)
1b)
> lmefit2<-lme(log10(FeedingtimeWithPrep) ~
log10(Gram)*Diet,random=~1|Place,data=diet)
> 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
> 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
2a)
> lmfit1<-lm(log10(FeedingTime) ~ log10(Gram)*Diet,data=diet)
2b)
> lmfit2<-lm(log10(FeedingtimeWithPrep) ~ log10(Gram)*Diet,data=diet)
> 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
2b)
> 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
[[alternative HTML version deleted]]