[R-sig-ME] heteroscedasticity (Thomas Mang)
De Smedt Sebastiaan
Sebastiaan.DeSmedt at ua.ac.be
Tue Nov 10 12:08:49 CET 2009
Hi,
In lme4 it is at this moment not possible to add variance structures to
mixed-effects models. However in the former version of lme4, nlme, you
can add these functions. See the book of Pinheiro & Bates, 2002 or this
mailing list!
Hope this helps,
Sebastiaan De Smedt
-----Original Message-----
From: r-sig-mixed-models-bounces at r-project.org
[mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of
r-sig-mixed-models-request at r-project.org
Sent: Monday, November 09, 2009 12:00 PM
To: r-sig-mixed-models at r-project.org
Subject: R-sig-mixed-models Digest, Vol 35, Issue 6
Send R-sig-mixed-models mailing list submissions to
r-sig-mixed-models at r-project.org
To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
or, via email, send a message with subject or body 'help' to
r-sig-mixed-models-request at r-project.org
You can reach the person managing the list at
r-sig-mixed-models-owner at r-project.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."
Today's Topics:
1. heteroscedasticity (Thomas Mang)
2. Linear Mixed-Effects Models (lme), question about parameter
estimates and random effect (R.S. Cotter)
----------------------------------------------------------------------
Message: 1
Date: Sun, 08 Nov 2009 00:01:36 +0000
From: Thomas Mang <thomasmang.ng at googlemail.com>
Subject: [R-sig-ME] heteroscedasticity
To: r-sig-mixed-models at r-project.org
Message-ID: <4AF60A60.5030701 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,
Suppose may data consist of groups (which also define the levels for
random effects), which show group-wise heteroscedasticity, that is for
some groups the variance of residuals is larger than for the others.
Based on specific knowledge of the data and the problem this even makes
perfect sense and is actually a good sign. Technically however it's not
good of course, to put it mildly.
Is there a way in lme4 to handle heteroscedasticity (with known grouping
for the different variances) ?
Any suggestions ?
thanks
Thomas
------------------------------
Message: 2
Date: Sun, 8 Nov 2009 23:01:09 -0800
From: "R.S. Cotter" <cotter.rs at gmail.com>
Subject: [R-sig-ME] Linear Mixed-Effects Models (lme), question about
parameter estimates and random effect
To: r-sig-mixed-models at r-project.org
Message-ID:
<742479270911082301m52c22450pc7ce082c32ced5a0 at mail.gmail.com>
Content-Type: text/plain
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]]
------------------------------
_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
End of R-sig-mixed-models Digest, Vol 35, Issue 6
More information about the R-sig-mixed-models
mailing list