Discussion:
[R] unequal variance assumption for lme (mixed effect model)
shirley zhang
2007-06-28 01:55:31 UTC
Permalink
Dear Douglas and R-help,

Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal variance
in my data?

Thanks,
Shirley
Simon Blomberg
2007-06-28 02:44:29 UTC
Permalink
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see ?varClasses. A
simple example would be to allow unequal variances across groups. So if
your call to lme was:

lme(...,random=~1|group,...)

then to allow each group to have its own variance, use:

lme(...,random=~1|group, weights=varIdent(form=~1|group),...)

You really really should read Pinheiro & Bates (2000). It's all there.

HTH,

Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal variance
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia

Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au

The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
shirley zhang
2007-06-28 03:14:19 UTC
Permalink
Hi Simon,

Thanks for your reply. Your reply reminds me that book. I've read it
long time ago, but haven't try the weights option in my projects
yet:)

Is the heteroscedastic test always less powerful because we have to
estimate the within group variance from the given data?

Should we check whether each group has equal variance before using
weights=varIdent()? If we should, what is the function for linear
mixed model?

Thanks,
Shirley
Post by Simon Blomberg
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see ?varClasses. A
simple example would be to allow unequal variances across groups. So if
lme(...,random=~1|group,...)
lme(...,random=~1|group, weights=varIdent(form=~1|group),...)
You really really should read Pinheiro & Bates (2000). It's all there.
HTH,
Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal variance
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
Spencer Graves
2007-06-29 15:58:41 UTC
Permalink
<comments in line>
Post by shirley zhang
Hi Simon,
Thanks for your reply. Your reply reminds me that book. I've read it
long time ago, but haven't try the weights option in my projects
yet:)
Is the heteroscedastic test always less powerful because we have to
estimate the within group variance from the given data?
SG: In general, I suspect we generally lose power when we estimate more
parameters.

SG: You can check this using the 'simulate.lme' function, whose use is
illustrated in the seminal work reported in sect. 2.4 of Pinheiro and
Bates (2000) Mixed-Effects Models in S and S-Plus (Springer).
Post by shirley zhang
Should we check whether each group has equal variance before using
weights=varIdent()? If we should, what is the function for linear
mixed model?
SG: The general advice I've seen is to avoid excessive
overparameterization of heterscedasticity and correlations. However,
parsimonious correlation had heterscedasticity models would likely be
wise. Years ago, George Box expressed concern about people worrying too
much about outliers, which are often fairly obvious and relatively easy
to detect, while they worried too little, he thought, about dependence,
especially serial dependence, which is generally more difficult to
detect and creates bigger problems in inference than outliers. He
wrote, "Why worry about mice when there are tigers about?"

SG: Issues of this type can be fairly easily evaluated using
'simulate.lme'.

Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks,
Shirley
Post by Simon Blomberg
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see ?varClasses. A
simple example would be to allow unequal variances across groups. So if
lme(...,random=~1|group,...)
lme(...,random=~1|group, weights=varIdent(form=~1|group),...)
You really really should read Pinheiro & Bates (2000). It's all there.
HTH,
Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal variance
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
shirley zhang
2007-07-01 17:49:12 UTC
Permalink
Thanks for Spencer and Simon's help. I've got very interesting
results based on your suggestions.

One more question, how to handle unequal variance problme in lm()?
Isn't the weights option also, which means weighted least squares,
right? Can you give me an example of setting this parameter in lm()
to account for different variance assumption in each group?

Thanks again,
Shirley
Post by Spencer Graves
<comments in line>
Post by shirley zhang
Hi Simon,
Thanks for your reply. Your reply reminds me that book. I've read it
long time ago, but haven't try the weights option in my projects
yet:)
Is the heteroscedastic test always less powerful because we have to
estimate the within group variance from the given data?
SG: In general, I suspect we generally lose power when we estimate more
parameters.
SG: You can check this using the 'simulate.lme' function, whose use is
illustrated in the seminal work reported in sect. 2.4 of Pinheiro and
Bates (2000) Mixed-Effects Models in S and S-Plus (Springer).
Post by shirley zhang
Should we check whether each group has equal variance before using
weights=varIdent()? If we should, what is the function for linear
mixed model?
SG: The general advice I've seen is to avoid excessive
overparameterization of heterscedasticity and correlations. However,
parsimonious correlation had heterscedasticity models would likely be
wise. Years ago, George Box expressed concern about people worrying too
much about outliers, which are often fairly obvious and relatively easy
to detect, while they worried too little, he thought, about dependence,
especially serial dependence, which is generally more difficult to
detect and creates bigger problems in inference than outliers. He
wrote, "Why worry about mice when there are tigers about?"
SG: Issues of this type can be fairly easily evaluated using
'simulate.lme'.
Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks,
Shirley
Post by Simon Blomberg
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see ?varClasses. A
simple example would be to allow unequal variances across groups. So if
lme(...,random=~1|group,...)
lme(...,random=~1|group, weights=varIdent(form=~1|group),...)
You really really should read Pinheiro & Bates (2000). It's all there.
HTH,
Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal variance
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Spencer Graves
2007-07-01 21:30:05 UTC
Permalink
The 'weights' argument on 'lm' is assumed to identify a vector of
the same length as the response, giving numbers that are inversely
proportional to the variance for each observation.

However, 'lm' provides no capability to estimate weights. If you
want to do that, the varFunc capabilities in the 'nlme' package is the
best tool I know for that purpose.

If someone thinks there are better tools available for estimating
heterscedasticity, I hope s/he will enlighten us both.

Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks for Spencer and Simon's help. I've got very interesting
results based on your suggestions.
One more question, how to handle unequal variance problme in lm()?
Isn't the weights option also, which means weighted least squares,
right? Can you give me an example of setting this parameter in lm()
to account for different variance assumption in each group?
Thanks again,
Shirley
Post by Spencer Graves
<comments in line>
Post by shirley zhang
Hi Simon,
Thanks for your reply. Your reply reminds me that book. I've read it
long time ago, but haven't try the weights option in my projects
yet:)
Is the heteroscedastic test always less powerful because we have to
estimate the within group variance from the given data?
SG: In general, I suspect we generally lose power when we estimate more
parameters.
SG: You can check this using the 'simulate.lme' function, whose use is
illustrated in the seminal work reported in sect. 2.4 of Pinheiro and
Bates (2000) Mixed-Effects Models in S and S-Plus (Springer).
Post by shirley zhang
Should we check whether each group has equal variance before using
weights=varIdent()? If we should, what is the function for linear
mixed model?
SG: The general advice I've seen is to avoid excessive
overparameterization of heterscedasticity and correlations. However,
parsimonious correlation had heterscedasticity models would likely be
wise. Years ago, George Box expressed concern about people worrying too
much about outliers, which are often fairly obvious and relatively easy
to detect, while they worried too little, he thought, about dependence,
especially serial dependence, which is generally more difficult to
detect and creates bigger problems in inference than outliers. He
wrote, "Why worry about mice when there are tigers about?"
SG: Issues of this type can be fairly easily evaluated using
'simulate.lme'.
Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks,
Shirley
Post by Simon Blomberg
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see
?varClasses. A
Post by shirley zhang
Post by Simon Blomberg
simple example would be to allow unequal variances across groups.
So if
Post by shirley zhang
Post by Simon Blomberg
lme(...,random=~1|group,...)
lme(...,random=~1|group, weights=varIdent(form=~1|group),...)
You really really should read Pinheiro & Bates (2000). It's all
there.
Post by shirley zhang
Post by Simon Blomberg
HTH,
Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal
variance
Post by shirley zhang
Post by Simon Blomberg
Post by shirley zhang
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
Post by shirley zhang
Post by Simon Blomberg
Post by shirley zhang
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
Post by shirley zhang
and provide commented, minimal, self-contained, reproducible code.
joris.dewolf
2007-07-02 07:28:26 UTC
Permalink
gls() from the package nlme is similar to lm but is meant for models
without random effects.

Joris






Spencer Graves
<spencer.graves at p
df.com> To
Sent by: shirley zhang
r-help-bounces at st <shirley0818 at gmail.com>
at.math.ethz.ch cc
R-help at stat.math.ethz.ch
Subject
01/07/2007 23:30 Re: [R] unequal variance assumption
for lme (mixed effect model)










The 'weights' argument on 'lm' is assumed to identify a vector of
the same length as the response, giving numbers that are inversely
proportional to the variance for each observation.

However, 'lm' provides no capability to estimate weights. If you
want to do that, the varFunc capabilities in the 'nlme' package is the
best tool I know for that purpose.

If someone thinks there are better tools available for estimating
heterscedasticity, I hope s/he will enlighten us both.

Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks for Spencer and Simon's help. I've got very interesting
results based on your suggestions.
One more question, how to handle unequal variance problme in lm()?
Isn't the weights option also, which means weighted least squares,
right? Can you give me an example of setting this parameter in lm()
to account for different variance assumption in each group?
Thanks again,
Shirley
Post by Spencer Graves
<comments in line>
Post by shirley zhang
Hi Simon,
Thanks for your reply. Your reply reminds me that book. I've read it
long time ago, but haven't try the weights option in my projects
yet:)
Is the heteroscedastic test always less powerful because we have to
estimate the within group variance from the given data?
SG: In general, I suspect we generally lose power when we estimate more
parameters.
SG: You can check this using the 'simulate.lme' function, whose use is
illustrated in the seminal work reported in sect. 2.4 of Pinheiro and
Bates (2000) Mixed-Effects Models in S and S-Plus (Springer).
Post by shirley zhang
Should we check whether each group has equal variance before using
weights=varIdent()? If we should, what is the function for linear
mixed model?
SG: The general advice I've seen is to avoid excessive
overparameterization of heterscedasticity and correlations. However,
parsimonious correlation had heterscedasticity models would likely be
wise. Years ago, George Box expressed concern about people worrying too
much about outliers, which are often fairly obvious and relatively easy
to detect, while they worried too little, he thought, about dependence,
especially serial dependence, which is generally more difficult to
detect and creates bigger problems in inference than outliers. He
wrote, "Why worry about mice when there are tigers about?"
SG: Issues of this type can be fairly easily evaluated using
'simulate.lme'.
Hope this helps.
Spencer Graves
Post by shirley zhang
Thanks,
Shirley
Post by Simon Blomberg
The default settings for lme do assume equal variances within groups.
You can change that by using the various varClasses. see
?varClasses. A
Post by shirley zhang
Post by Simon Blomberg
simple example would be to allow unequal variances across groups.
So if
Post by shirley zhang
Post by Simon Blomberg
lme(...,random=~1|group,...)
lme(...,random=~1|group, weights=varIdent(form=~1|group),...)
You really really should read Pinheiro & Bates (2000). It's all
there.
Post by shirley zhang
Post by Simon Blomberg
HTH,
Simon.
Post by shirley zhang
Dear Douglas and R-help,
Does lme assume normal distribution AND equal variance among groups
like anova() does? If it does, is there any method like unequal
variance T-test (Welch T) in lme when each group has unequal
variance
Post by shirley zhang
Post by Simon Blomberg
Post by shirley zhang
in my data?
Thanks,
Shirley
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
Post by shirley zhang
Post by Simon Blomberg
Post by shirley zhang
and provide commented, minimal, self-contained, reproducible code.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320, Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
Post by shirley zhang
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...