glmmPQL中的重复测量和比例数据

时间:2018-09-26 05:17:20

标签: r glm mixed-models

关于运行带有比例响应变量的glmm,我有两个问题。 我正在使用从这个问题修改的代码: Errors trying to run glmer with paired data and repeated measures (lme4)

首先,我的代码(数据位于结尾):

    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是介于0到1(包括0)之间的值。

上面的代码给出以下错误:

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!

问题1:我猜这个错误告诉我我的设计不平衡,这是正确的-采样困难意味着必须放弃一些“时间*治疗”组合。如果正确的话,是否有另一种方法可以说明某个站点的重复措施何时完成?

问题2:我不能将线性比例作为响应变量。因此

cbind(Ground, 1-Ground)

那么,我是否正确地完成了这一部分?对于每个比例的地面覆盖物,我都生成了剩余的比例,所以现在每对都加到1。

数据:

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   

0 个答案:

没有答案