[R-sig-ME] ANOVA type lll ss table for GLMER?

Ben Bolker bbolker at gmail.com
Wed May 14 21:47:35 CEST 2014


On 14-05-14 10:02 AM, Henrik Singmann wrote:
> Dear Heather,
> 
> you could try to use mixed from the afex package which will give you
> Type III p-values for the effects via Chi^2 tests (or alternatively via
> parametric bootstrap):
> 
> require(afex)
> (spden2 <- mixed(SpDens~(treat*samp)-1+(1|TRANSECT),family=poisson,
> data=rm, nAGQ = 9, method = "LRT")
> 
> Note however, that loading afex changes your overall contrasts, to reset
> the default contrasts use:
> options(contrasts=c('contr.treatment', 'contr.poly'))

   But (despite the fact that I **really** don't like afex's default
behaviour of changing the overall contrasts) -- you should definitely
use contr.sum when computing a marginal ANOVA table (i.e. do NOT reset
the contrasts until after you're done constructing your table), if you
insist on doing that.

> 
> Furthermore, (g)lmer doesn't break the factors done by *all* levels. It
> removes the first levels (usually). Hence the parameters cannot directly
> be interpreted if this level is "significant".
> 
> Hope this helps,
> Henrik
> 
> Am 14.05.2014 15:45, schrieb Heather Moylett:
>>   Hello group,
>>
>> This is my first time posting, so I hope I have explained my needs
>> clearly
>> below.
>>
>> I am running a repeated measure analysis with a raw species count data
>> set
>> (SpDens). I have run different model types (zeroinfl, glm, glmer) and
>> have
>> identified glmer to have the best fit. The output generated by GLMER
>> breaks
>> my between groups (treat) and within groups (samp) factors down by
>> levels.
>> In addition to this, I would like to look at the effect of treat and samp
>> overall, something similar to an ANOVA table (Type lll SS). When I use
>> Anova(object) I receive an ANOVA table with an F val and no P-vals. I
>> would
>> prefer to stick with the z-stat and p-vals. I have seen this reported in
>> other papers, so I know it can be done...just can't figure out how to
>> do it!
>>
>> Components of the model:
>> samp: 23 sampling dates is the repeated measure (within groups)
>> treat: 4 levels (between groups)
>> TRANSECT: experimental unit (subject), 4/treat and data collected from
>> all
>> 16 every sampling date
>>
>> When I run this code:
>>
>> RM <- read.csv("C:/Users/heatbell/Desktop/Walthour-Moss/STATS/CH
>> 1/Final/R/RM.csv")
>>
>> View(RM)
>>
>> rm <- subset(RM, SAMPLE >= 2)
>>
>>
>>
>> rm<- within(rm, {
>>
>>    samp<-factor(SAMPLE)
>>
>>    yr<-factor(YEAR)
>>
>>    treat<-factor(TREAT)
>>
>> })
>>
>> summary(rm)
>>
>>
>> summary(spden<-glmer(SpDens~(treat*samp)-1+(1|TRANSECT),family=poisson,
>> data=rm, nAGQ = 9))
>>
>> Thank you for the help!
>> Heather
>>
>



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