Skip to content

Overdispersion using repeated measures lmer

8 messages · ONKELINX, Thierry, Christine Griffiths, Michael Hannon +3 more

#
Dear All

I am trying to do a repeated measures analysis using lmer and have a number 
of issues. I have non-orthogonal, unbalanced data.  Count data was obtained 
over 10 months for three treatments, which were arranged into 6 blocks. 
Treatment is not nested in Block but crossed, as I originally designed an 
orthogonal, balanced experiment but subsequently lost a treatment from 2 
blocks. My fixed effects are treatment and Month, and my random effects are 
Block which was repeated sampled.  My model is:

Model<-lmer(Count~Treatment*Month+(Month|Block),data=dataset,family=poisson(link=sqrt))

Is this the only way in which I can specify my random effects? I.e. can I 
specify them as: (1|Block)+(1|Month)?

When I run this model, I do not get any residuals in the error term or 
estimated scale parameters and so do not know how to check if I have 
overdispersion. Below is the output I obtained.

Generalized linear mixed model fit by the Laplace approximation
Formula: Count ~ Treatment * Month + (Month | Block)
   Data: dataset
   AIC   BIC logLik deviance
 310.9 338.5 -146.4    292.9
Random effects:
 Groups Name        Variance   Std.Dev. Corr
 Block  (Intercept) 0.06882396 0.262343
        Month       0.00011693 0.010813 1.000
Number of obs: 160, groups: Block, 6

Fixed effects:
                          Estimate Std. Error z value Pr(>|z|)
(Intercept)               1.624030   0.175827   9.237  < 2e-16 ***
Treatment2.Radiata        0.150957   0.207435   0.728 0.466777
Treatment3.Aldabra       -0.005458   0.207435  -0.026 0.979009
Month                    -0.079955   0.022903  -3.491 0.000481 ***
Treatment2.Radiata:Month  0.048868   0.033340   1.466 0.142717
Treatment3.Aldabra:Month  0.077697   0.033340   2.330 0.019781 *
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Correlation of Fixed Effects:
            (Intr) Trt2.R Trt3.A Month  T2.R:M
Trtmnt2.Rdt -0.533
Trtmnt3.Ald -0.533  0.450
Month       -0.572  0.585  0.585
Trtmnt2.R:M  0.474 -0.882 -0.402 -0.661
Trtmnt3.A:M  0.474 -0.402 -0.882 -0.661  0.454


Any advice on how to account for overdispersion would be much appreciated.

Many thanks in advance
Christine

----------------------
Christine Griffiths
School of Biological Sciences
University of Bristol
Woodland Road
Bristol BS8 1UG
Tel: 0117 9287593
Fax 0117 925 7374
Christine.Griffiths at bristol.ac.uk
http://www.bio.bris.ac.uk/research/mammal/tortoises.html
#
Dear Christine,

The poisson family does not allow for overdispersion (nor
underdispersion). Try using the quasipoisson family instead.

HTH,

Thierry

 


------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

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

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Christine Griffiths
Verzonden: maandag 18 mei 2009 13:26
Aan: r-help at r-project.org
Onderwerp: [R] Overdispersion using repeated measures lmer

Dear All

I am trying to do a repeated measures analysis using lmer and have a
number of issues. I have non-orthogonal, unbalanced data.  Count data
was obtained over 10 months for three treatments, which were arranged
into 6 blocks. 
Treatment is not nested in Block but crossed, as I originally designed
an orthogonal, balanced experiment but subsequently lost a treatment
from 2 blocks. My fixed effects are treatment and Month, and my random
effects are Block which was repeated sampled.  My model is:

Model<-lmer(Count~Treatment*Month+(Month|Block),data=dataset,family=pois
son(link=sqrt))

Is this the only way in which I can specify my random effects? I.e. can
I specify them as: (1|Block)+(1|Month)?

When I run this model, I do not get any residuals in the error term or
estimated scale parameters and so do not know how to check if I have
overdispersion. Below is the output I obtained.

Generalized linear mixed model fit by the Laplace approximation
Formula: Count ~ Treatment * Month + (Month | Block)
   Data: dataset
   AIC   BIC logLik deviance
 310.9 338.5 -146.4    292.9
Random effects:
 Groups Name        Variance   Std.Dev. Corr
 Block  (Intercept) 0.06882396 0.262343
        Month       0.00011693 0.010813 1.000
Number of obs: 160, groups: Block, 6

Fixed effects:
                          Estimate Std. Error z value Pr(>|z|)
(Intercept)               1.624030   0.175827   9.237  < 2e-16 ***
Treatment2.Radiata        0.150957   0.207435   0.728 0.466777
Treatment3.Aldabra       -0.005458   0.207435  -0.026 0.979009
Month                    -0.079955   0.022903  -3.491 0.000481 ***
Treatment2.Radiata:Month  0.048868   0.033340   1.466 0.142717
Treatment3.Aldabra:Month  0.077697   0.033340   2.330 0.019781 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Trt2.R Trt3.A Month  T2.R:M Trtmnt2.Rdt -0.533
Trtmnt3.Ald -0.533  0.450
Month       -0.572  0.585  0.585
Trtmnt2.R:M  0.474 -0.882 -0.402 -0.661
Trtmnt3.A:M  0.474 -0.402 -0.882 -0.661  0.454


Any advice on how to account for overdispersion would be much
appreciated.

Many thanks in advance
Christine

----------------------
Christine Griffiths
School of Biological Sciences
University of Bristol
Woodland Road
Bristol BS8 1UG
Tel: 0117 9287593
Fax 0117 925 7374
Christine.Griffiths at bristol.ac.uk
http://www.bio.bris.ac.uk/research/mammal/tortoises.html

______________________________________________
R-help at r-project.org 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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.
#
Thanks. I did try using quasipoisson and a negative binomial error but am
unsure of the degree of overdispersion and whether it is simply due to
missing values. I am investigating to see if I can replace these missing
values so that I can have a balanced orthogonal design and use lme or aov
instead which is easier to interpret. Any ideas on whether it is feasible to
replace missing values for a small dataset with repeated measures? I have 6
blocks with 3 treatments sampled over 10 months. Two blocks are missing one
treatment, albeit a different one. Also any suggestions about how I would go
about this would be much appreciated. 

I am also unsure of whether my random effects (Month|Block) for repeated
measures with random slope and intercept is correct and whether (1|Month) +
(1|Block) represents repeated measures. Any confirmation would be great. 

Cheers
Christine
Christine Griffiths-2 wrote:

  
    
#
Dear Christine,

(Month|Block) and (1|Block) + (1|Month) are completely different random effects. The first assumes that each Block exhibits a different linear trend along Month. The latter assumes that each block has a random effect, each month has a random effect and that the random effects of block and month are independent. So each month has a different effect, but within a given month that effect is the same on each block. It is up to you to see if that kind of assumption is valid in your design.

Missing values should not be a problem, as long as they are missing at random. I would not try to impute the missing values. How would you determine the imputed values? That requires a lot of assumptions and they could affect your model parameters.

HTH,

Thierry


----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

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

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Christine Griffiths
Verzonden: dinsdag 19 mei 2009 11:01
Aan: r-help at r-project.org
Onderwerp: Re: [R] Overdispersion using repeated measures lmer


Thanks. I did try using quasipoisson and a negative binomial error but am unsure of the degree of overdispersion and whether it is simply due to missing values. I am investigating to see if I can replace these missing values so that I can have a balanced orthogonal design and use lme or aov instead which is easier to interpret. Any ideas on whether it is feasible to replace missing values for a small dataset with repeated measures? I have 6 blocks with 3 treatments sampled over 10 months. Two blocks are missing one treatment, albeit a different one. Also any suggestions about how I would go about this would be much appreciated. 

I am also unsure of whether my random effects (Month|Block) for repeated measures with random slope and intercept is correct and whether (1|Month) +
(1|Block) represents repeated measures. Any confirmation would be great. 

Cheers
Christine
Christine Griffiths-2 wrote:
--
View this message in context: http://www.nabble.com/Overdispersion-using-repeated-measures-lmer-tp23595955p23612349.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org 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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.
#
Greetings.  I'm trying to learn to program in R.  (I'm definitely NOT new to
programming, just to R.)  A colleague suggested that I have a look at the
book:

    An Introduction to S and S-Plus
by:
    Phil Spector

I've glanced at the book, and it does indeed seem to be the kind of thing I
wanted, but in the Introduction to the book, the author says he'll be using
several example data sets throughout the book, including:

    1. auto.stats

    2. saving.x

    3. rain.nyc1

    4. state.x77

The author states:

    These data sets should be available as part of the standard
    S distribution, so you can simply refer to them as they are
    used in the examples.

Of course I want to use R, not S.  I have every "R-*" package installed on my
Fedora linux system, but I can't find any of the data sets mentioned above.
(The command "locate rain.nyc" produces no output, for instance.)

It's entirely possible that these data sets are installed, but I just don't
know enough about R to determine that.

Hence, I need to help to find out if the data sets are installed, or if they CAN
be installed, etc.

If you can steer me in the right direction, please do so.

Thanks.

-- Mike
#
Maybe you should just bypass that book for one of these?

http://www.springer.com/series/6991

-Ro
On Tue, May 19, 2009 at 12:01 PM, Michael Hannon <jm_hannon at yahoo.com> wrote:
#
On Tue, May 19, 2009 at 2:01 PM, Michael Hannon <jm_hannon at yahoo.com> wrote:
Not an unreasonable first guess but in R you need parentheses around
the arguments in function calls and you would need to quote the name
of the object.  Even when you do those things and guess at the
function name being find instead of locate you still won't get any
joy.
character(0)

The state.x77 data set is part of the datasets package but the others
never seemed to make it from S to R.  If you want to find out what is
available you can try

ls.str("package:datasets")

and stare at the output for a while until it begins to make sense.  In
general, an experienced programmer can learn a lot about the structure
of an object in R by applying Martin Maechler's str function to it.
The ls.str function is the equivalent of asking for a listing of the
objects in a namespace and applying str to each of those names.

Two recent books that I would recommend for learning R are Robert
Gentleman's "R Programming for Bioinformatics" and John Chambers
"Software for Data Analysis".  Robert (one of the two "R"'s who
started the R Project) gives you a broad overview of tools available
and considerable detail on the important parts.  John, the designer
and implementor of the S language the preceded R, describes how to
think about the programming task in R.  Both are worth reading.
#
My favorite tool for finding things like this is 
"RSiteSearch.function" in the "RSiteSearch" package.  For the objects 
you mention, I get the following: 


library(RSiteSearch)
hits(a.s <- RSiteSearch.function("auto.stats")) # 0
hits(sx <- RSiteSearch.function("saving.x"))  # 0
hits(rn <- RSiteSearch.function("rain.nyc1")) # 0
hits(s77 <- RSiteSearch.function("state.x77")) # 12
HTML(s77) # View the 12 and find "states" in the "datasets" package. 

hits(ps <- RSiteSearch.function("Phil Spector"))  # 0

     
      If you are still interested in that book, you might write to the 
author, suggesting he might get more readers by providing a package that 
includes those data sets.  If he were really interested in having more 
readers, he might also include script files providing R scripts for 
working all the examples in the book, as Doug Bates does in the "nlme" 
package, which can be found using "system.file('scripts', 
package='nlme')".  These provide R code to work essentially all the 
examples in Pinhiero and Bates (2000) Mixed-Effects Models in S and 
S-Plus (Springer).  For me, those files made reading that book much 
easier, more pleasant and memorable. 


      Hope this helps. 
      Spencer Graves
Douglas Bates wrote: