I have two questions about running a glmm with a proportional response variable. I am using code modified from this question: Errors trying to run glmer with paired data and repeated measures (lme4)
First, my code (data is at the end):
fit2 = glmmPQL(cbind(Ground, 1-Ground) ~ Treatment*Time,
random=~1|Site/Treatment, data=alitter[complete.cases(alitter$Ground),], # removes blanks
family=binomial(link = "logit"), correlation=corCAR1(form = ~Time|Site/Treatment))
Ground is a value ranging from 0 to 1 (including 0).
The code above gives the following error:
Error in Initialize.corCAR1(X[[i]], ...) :
covariate must have unique values within groups for "corCAR1" objects
In addition: Warning message:
In eval(family$initialize) : non-integer counts in a binomial glm!
Question 1: I am guessing the error is telling me my design is not balanced, which is correct - sampling difficulty meant some Time*Treatment combinations had to be abandoned. If this is correct, is there another way to account for when the repeated measures at a site are complete?
Question 2: I can't have straight proportions as the response variable. Hence
cbind(Ground, 1-Ground)
So, have I done that part correctly? For every proportion of ground cover, I have generated the remaining proportion, so every pair now adds to 1.
Data:
Site Treatment Time Sample Ground
Flynns Treatment Post 7 0
Flynns Treatment Post 6 0
Flynns Treatment Post 1 0
Flynns Treatment Post 2 0
Flynns Treatment Post 10 0
Flynns Treatment Pre 6 0
Flynns Treatment Pre 5 0
Peake Treatment Pre 1 0
Flynns Control Pre 10 0
Homestead Treatment Post 3 0
Homestead Control Post 5 0
Homestead Control Post 8 0
Homestead Control Post 6 0
Homestead Control Post 7 0
Burgan Treatment Post 8 0.0075
Flynns Treatment Post 8 0.01
Burgan Treatment Post 4 0.015
Homestead Treatment Post 1 0.015
Homestead Treatment Post 10 0.015
Flynns Treatment Post 5 0.02
Burgan Treatment Post 3 0.02
Homestead Treatment Post 6 0.02
Burgan Treatment Post 2 0.025
Grants tk Treatment Post 2 0.03
Flynns Treatment Post 4 0.03
Homestead Treatment Post 2 0.03
Flynns Treatment Post 9 0.04
Flynns Treatment Post 3 0.04
Peake Treatment Post 6 0.04
Homestead Treatment Post 4 0.04
Homestead Treatment Post 9 0.045
Flynns Treatment Pre 7 0.05
Flynns Treatment Pre 9 0.05
Flynns Control Pre 1 0.05
Flynns Treatment Pre 10 0.05
Flynns Treatment Pre 8 0.05
Flynns Control Pre 2 0.05
Flynns Control Pre 7 0.05
Grants tk Treatment Pre 10 0.05
Burgan Treatment Pre 5 0.05
Flynns Control Pre 5 0.05
Grants tk Control Pre 2 0.05
Peake Treatment Pre 5 0.05
Burgan Treatment Pre 2 0.05
Burgan Treatment Pre 4 0.05
Burgan Treatment Pre 1 0.05
Grants tk Control Pre 9 0.05
Grants tk Treatment Pre 9 0.05
Homestead Control Post 4 0.05
Homestead Treatment Pre 6 0.05
Peake Treatment Pre 8 0.05
Peake Treatment Pre 4 0.05
Homestead Control Post 3 0.05
Homestead Treatment Pre 3 0.05
Peake Treatment Post 5 0.05
Peake Treatment Pre 10 0.05
Homestead Control Post 2 0.05
Peake Control Post 2 0.05
Homestead Control Post 10 0.05
Peake Control Post 3 0.05
Burgan Treatment Post 7 0.0525
Grants tk Treatment Post 6 0.06
Burgan Treatment Post 5 0.075
Peake Treatment Post 1 0.0825
Homestead Treatment Post 8 0.09
Flynns Treatment Pre 3 0.1
Burgan Treatment Pre 10 0.1
Grants tk Control Post 3 0.1
Flynns Treatment Pre 4 0.1
Homestead Treatment Pre 7 0.1
Flynns Control Pre 6 0.1
Peake Control Post 5 0.1
Grants tk Control Post 2 0.1
Burgan Treatment Pre 6 0.1
Peake Control Post 6 0.1
Grants tk Control Post 10 0.1
Peake Control Pre 3 0.1
Grants tk Control Post 7 0.1
Flynns Control Pre 3 0.1
Peake Treatment Post 8 0.1
Peake Control Pre 2 0.1
Grants tk Treatment Pre 4 0.1
Homestead Treatment Pre 9 0.1
Grants tk Treatment Pre 8 0.1
Peake Control Pre 9 0.1
Grants tk Treatment Post 9 0.1
Homestead Treatment Pre 4 0.1
Flynns Control Pre 8 0.1
Peake Control Post 7 0.1
Grants tk Control Post 9 0.1
Burgan Treatment Pre 3 0.1
Grants tk Treatment Pre 5 0.1
Peake Control Post 10 0.1
Peake Control Pre 6 0.1
Peake Treatment Pre 7 0.1
Peake Treatment Pre 9 0.1
Peake Control Pre 7 0.1
Grants tk Control Pre 4 0.1
Burgan Treatment Pre 8 0.1
Grants tk Treatment Post 8 0.1
Homestead Treatment Pre 2 0.1
Peake Treatment Pre 6 0.1
Peake Control Pre 8 0.1
Peake Control Post 4 0.1
Homestead Control Post 1 0.1
Burgan Control Post 3 0.1
Homestead Control Post 9 0.1
Homestead Treatment Post 5 0.11
Grants tk Treatment Post 10 0.12
Grants tk Treatment Post 7 0.12
Burgan Treatment Post 6 0.12
Burgan Treatment Post 1 0.135
Burgan Treatment Post 9 0.14
Burgan Treatment Post 10 0.1425
Flynns Treatment Pre 2 0.15
Flynns Treatment Pre 1 0.15
Burgan Treatment Pre 9 0.15
Grants tk Control Post 1 0.15
Grants tk Treatment Pre 2 0.15
Grants tk Treatment Post 4 0.15
Grants tk Control Pre 3 0.15
Flynns Control Pre 4 0.15
Grants tk Control Post 4 0.15
Grants tk Treatment Pre 7 0.15
Grants tk Control Pre 6 0.15
Burgan Treatment Pre 7 0.15
Homestead Treatment Pre 1 0.15
Homestead Treatment Pre 10 0.15
Flynns Control Pre 9 0.15
Grants tk Control Pre 7 0.15
Grants tk Control Pre 5 0.15
Grants tk Treatment Pre 3 0.15
Grants tk Control Pre 10 0.15
Peake Control Post 9 0.15
Peake Treatment Pre 3 0.15
Grants tk Treatment Pre 6 0.15
Homestead Treatment Pre 5 0.15
Homestead Treatment Pre 8 0.15
Peake Control Post 8 0.15
Burgan Control Post 10 0.15
Burgan Control Post 7 0.15
Peake Control Pre 10 0.15
Peake Treatment Post 7 0.15
Peake Treatment Post 10 0.15
Grants tk Treatment Post 5 0.1575
Peake Treatment Post 4 0.1625
Grants tk Control Post 6 0.2
Peake Control Post 1 0.2
Peake Treatment Post 2 0.2
Grants tk Treatment Post 3 0.2
Grants tk Control Pre 1 0.2
Grants tk Treatment Pre 1 0.2
Peake Control Pre 5 0.2
Peake Control Pre 4 0.2
Burgan Control Post 9 0.2
Homestead Treatment Post 7 0.2
Burgan Control Post 8 0.2
Peake Treatment Post 9 0.2
Burgan Control Post 6 0.2
Peake Treatment Post 3 0.225
Peake Control Pre 1 0.25
Burgan Control Post 5 0.25
Peake Treatment Pre 2 0.25
Grants tk Control Pre 8 0.25
Burgan Control Post 2 0.25
Grants tk Treatment Post 1 0.315
Grants tk Control Post 8 0.35
Burgan Control Post 1 0.35
Grants tk Control Post 5 0.4
Burgan Control Post 4 0.4
Flynns Control Post 2
Flynns Control Post 3
Flynns Control Post 6
Homestead Control Pre 10
Flynns Control Post 5
Flynns Control Post 10
Flynns Control Post 7
Homestead Control Pre 9
Homestead Control Pre 7
Flynns Control Post 8
Flynns Control Post 1
Flynns Control Post 4
Flynns Control Post 9
Homestead Control Pre 1
Homestead Control Pre 6
Homestead Control Pre 5
Homestead Control Pre 3
Homestead Control Pre 8
Homestead Control Pre 4
Homestead Control Pre 2