[R-sig-ME] ICC for quasipoisson?

Mike Lawrence Mike.Lawrence at dal.ca
Tue Sep 20 00:11:12 CEST 2011


I'm not sure if this will be of any help or not, but I just read this
paper myself and generated this code for computing the repeatability
point estimate of the intercept for the Gaussian case:

    fit = lmer(
           formula = DV ~ ( 1 | ID )
           , data = my_data
    )

    #obtain the residual and effect variance
    vc = VarCorr(fit)
    residual_var = attr(vc,'sc')^2
    intercept_var = attr(vc$ID,'stddev')[1]^2

    #compute the raw repeatability
    R = intercept_var/(intercept_var+residual_var)

    #prepare to compute the repeatability extrapolated to the experiment's size
    n = as.data.frame(table(my_data$ID))
    k = nrow(n)
    N = sum(n$Freq)
    n0 = (N-(sum(n$Freq^2)/N))/(k-1)

    #compute the repeatability given the experiment's size
    Rn = R/(R+(1-R)/n0)
    print(Rn)

In the binomial case (where you have raw 1s/0s in the DV and do the
fit with family=binomial) you do the same as above with the exception
that residual_var isn't estimated from the data but fixed at (pi^2)/3

As noted over at http://stats.stackexchange.com/questions/15768 I'm
still trying to figure out how to compute the confidence/credible
intervals...

Cheers,

Mike

--
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://goo.gl/BYH99

~ Certainty is folly... I think. ~



On Fri, Sep 16, 2011 at 7:30 AM, Dr C B Stride
<c.b.stride at sheffield.ac.uk> wrote:
> Thanks Elizabeth - have downloaded rptR, got it up and running and tested on
> a few simple examples - however, in my example (I should have mentioned!) I
> am modelling a rate rather than a raw count hence I have an offset term -
> does anyone know if/how that can be incorporated into the rptR code?
> Couldn't see anything in Nakagawa & Schielzeth, and the rpt function only
> has arguments for DV, grouping var and link fn)
>
> Likewise my data is cross-classified i.e I have multiple random effects
> hence multiple grouping vars...
>
>
>
> Elizabeth Oliva said the following on 13/09/2011 15:18:
>>
>> I haven't tried it yet (because I have to download the most recent version
>> of R); however, it's possible to use the link in the paper to download the
>> program to calculate the ICC. I think the website for the program has sample
>> code. However, I cc'd the author of the program just in case he might have
>> some sample code.
>>
>>
>>
>> On Tue, Sep 13, 2011 at 3:26 AM, Dr C B Stride <c.b.stride at sheffield.ac.uk
>> <mailto:c.b.stride at sheffield.ac.uk>> wrote:
>>
>>    Hi
>>
>>    Was wondering if anyone knows of a snippet of R code that will
>>    perform the ICC calculations recommended in this paper?
>>
>>    cheers
>>    Chris
>>
>>    Jarrod Hadfield said the following on 09/09/2011 16:51:
>>
>>        Hi,
>>
>>        You can find the relevant equations in Table 2 of:
>>
>>        Repeatability for Gaussian and non-Gaussian data: a practical
>>        guide for biologists. Biological reviews. 2010. Nakagawa1 &
>>        Schielzeth
>>
>>        Cheers,
>>
>>        Jarrod
>>
>>        Quoting Elizabeth Oliva <elizabeth.oliva at gmail.com
>>        <mailto:elizabeth.oliva at gmail.com>> on Fri, 9 Sep 2011 08:34:50
>>        -0700:
>>
>>            Hi all,
>>
>>            I’ve been searching at length for a way to figure out how to
>>            calculate the
>>            ICC for a mixed effects quasipoisson model in R from the
>>            output below (i.e.,
>>            intercept only model) and can't figure out the correct
>>            equation to use. For
>>            example, I've run mixed effects logistic regression models
>>            for which I used
>>            the following equation:
>>
>>                          c<-a*a
>>
>>                          icc<-c/(3.289868+c)
>>
>>            [a being the standard deviation of the intercept]
>>
>>
>>
>>            I'm not sure what the corollary type of equation is for
>>            quasipoisson mixed
>>            models.
>>
>>
>>
>>            If you had any suggestions I would greatly appreciate it.
>>
>>
>>
>>            Best,
>>
>>            Elizabeth
>>
>>
>>
>>
>>
>>            womentxengintonly <- glmmPQL(NewSpecOut_SUM ~ 1, random = ~1
>>            |NEPEC3N,
>>            family =quasipoisson, data = women)
>>
>>
>>
>>
>>
>>            summary(womentxengintonly)
>>
>>
>>
>>            Linear mixed-effects model fit by maximum likelihood
>>
>>            Data: women
>>
>>             AIC BIC logLik
>>
>>              NA  NA     NA
>>
>>
>>
>>            Random effects:
>>
>>            Formula: ~1 | NEPEC3N
>>
>>                   (Intercept) Residual
>>
>>            StdDev:   0.4679934  7.26936
>>
>>
>>
>>            Variance function:
>>
>>            Structure: fixed weights
>>
>>            Formula: ~invwt
>>
>>            Fixed effects: NewSpecOut_SUM ~ 1
>>
>>                          Value  Std.Error   DF  t-value p-value
>>
>>            (Intercept) 3.046308 0.04805773 4960 63.38852       0
>>
>>
>>
>>            Standardized Within-Group Residuals:
>>
>>                  Min         Q1        Med         Q3        Max
>>
>>            -1.0333625 -0.5507037 -0.3717204  0.2138915 12.4856954
>>
>>
>>
>>            Number of Observations: 5099
>>
>>            Number of Groups: 139
>>
>>               [[alternative HTML version deleted]]
>>
>>
>>
>>
>>
>>        --The University of Edinburgh is a charitable body, registered in
>>        Scotland, with registration number SC005336.
>>
>>        _________________________________________________
>>        R-sig-mixed-models at r-project.__org
>>        <mailto:R-sig-mixed-models at r-project.org> mailing list
>>        https://stat.ethz.ch/mailman/__listinfo/r-sig-mixed-models
>>        <https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
>>
>>
>>
>>    --     Dr Chris Stride, C. Stat, Statistician, Institute of Work
>>    Psychology, University of Sheffield
>>    Telephone: 0114 2223262
>>    Fax: 0114 2727206
>>
>>    “Figure It Out”
>>    Statistical Consultancy and Training Service for Social Scientists
>>
>>    Visit www.figureitout.org.uk <http://www.figureitout.org.uk> for
>>    details of my consultancy services, and forthcoming training
>>    courses, which are also available on an in-house basis:
>>    - Data Management using SPSS syntax
>>    - Multiple Regression using SPSS
>>    - Multilevel Modelling using SPSS
>>    - Structural Equation Modelling using MPlus
>>
>>
>
>
> --
> Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
> University of Sheffield
> Telephone: 0114 2223262
> Fax: 0114 2727206
>
> “Figure It Out”
> Statistical Consultancy and Training Service for Social Scientists
>
> Visit www.figureitout.org.uk for details of my consultancy services, and
> forthcoming training courses, which are also available on an in-house basis:
> - Data Management using SPSS syntax
> - Multiple Regression using SPSS
> - Multilevel Modelling using SPSS
> - Structural Equation Modelling using MPlus
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




More information about the R-sig-mixed-models mailing list