【问题标题】:Accounting for time with repeated-measures in lmer when not interested in time当对时间不感兴趣时​​,在 lmer 中使用重复测量来计算时间
【发布时间】:2021-09-08 20:48:19
【问题描述】:

我正在尝试使用 lmer 和 lmerTest 进行重复测量混合效应测试,但我不确定我是否正确。

我有 6 个地点,每个地点 3 个地块,连续 24 年每年采样一次。我有几个环境和物种变量,但为简单起见,假设我有两个环境变量(深度和温度)和两个物种(物种 1 和物种 2)。我对时间变量、随时间变化或相互作用不感兴趣,因为该系统具有很强的干湿季节性,旱季的影响超过了前一年物种的影响。我不一定每年都有所有变量和地块的数据,有些地块有时没有采样。

问题是相对于环境变量,物种2(捕食者)是否对物种1的种群有任何影响。

在模型中包含年份作为其自身的随机效应以及站点内的图是否合适?

model1 <- lmer(species1 ~ depth + temperature +  species2 + (1|year) + (1|site/plot), data=data)

对于这个特定的分析,总共有 435 次观察(情节/年),但我担心它没有适当地进行重复测量。

anova(model1)
Type III Analysis of Variance Table with Satterthwaite's method
               Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
depth          0.0221  0.0221     1 145.75  0.0908    0.7635    
temperature    9.0213  9.0213     1 422.19 37.0429 2.596e-09 ***
species2       0.0597  0.0597     1 418.95  0.2450    0.6208 

这似乎不对。合并年份是更好的方法,还是我应该包括年份?

如果我排除年份,为什么深度的 DenDF 变化如此剧烈?

model1 <- lmer(species1 ~ depth + temperature +  species2 + (1|year) + (1|site/plot), data=data)
Type III Analysis of Variance Table with Satterthwaite's method
               Sum Sq Mean Sq NumDF  DenDF  F value    Pr(>F)    
depth          2.599   2.599     1 431.77   7.1096  0.007955 ** 
temperature    58.788  58.788    1 432.10 160.7955 < 2.2e-16 ***
species2       0.853   0.853     1 429.62   2.3336  0.127343    

summary(M1)
Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: species1 ~ depth + temperature + species2 + (1 | site/plot)
   Data: data

     AIC      BIC   logLik deviance df.resid 
   833.4    861.9   -409.7    819.4      428 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-2.20675 -0.66119 -0.07051  0.52722  2.99942 

Random effects:
 Groups           Name        Variance  Std.Dev.
 plot:site        (Intercept) 0.0003221 0.01795 
 site             (Intercept) 0.2051143 0.45290 
 Residual                     0.3656072 0.60465 
Number of obs: 435, groups:  plot:site, 24; site, 6

Fixed effects:
                     Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)         -0.538258   0.325072  50.071940  -1.656  0.10401    
depth                0.006338   0.002377 431.768539   2.666  0.00796 ** 
temperature          0.391023   0.030837 432.101095  12.681  < 2e-16 ***
species2            -0.353264   0.231252 429.615226  -1.528  0.12734    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) depth  temp
depth       -0.316              
temperature -0.467 -0.204       
specie2     -0.544  0.040  0.007

【问题讨论】:

    标签: time-series lme4


    【解决方案1】:

    我问的问题可能比我回答的要多,但我希望其中的一些有用。

    “问题是相对于环境变量,物种 2(捕食者)是否对物种 1 的种群有任何影响。”

    我认为当你这样说时,它并不完全清楚。您是否对species2对species1的影响感兴趣-取决于环境变量是什么(换句话说,species2对species1的影响会根据深度或温度而变化?或者您的意思是您想比较species2的影响对物种1 的深度或温度对物种1 的影响?或者,您究竟是什么意思,“相对于环境变量”

    是的,(1|year) + (1|site/plot) 是年份和站点内地块的随机截距。如果您希望变量能够在每个组中变化(即具有随机斜率),如果您认为温度对物种1 的影响在不同年份可能不同,您可以执行 (Temperature|year) + (1|site/plot) 之类的操作。

    具体如何指定模型将取决于您对生物系统的了解和统计知识。根据您问题中的信息,您建议的这种随机效应公式对我来说似乎完全合理。是的,这允许您考虑分组数据(按每年和站点内的每个地块分组)。有可能只有 435 个观察值,您可能会遇到过于复杂的模型的收敛问题,您可能有也可能没有 - 只是需要注意的地方。

    我不确定您所说的“这似乎不对”是什么意思 - 您希望看到什么?缺少什么?

    我两次看到相同的模型(如下),输出的值不同,这里是否存在复制和粘贴错误,或者我遗漏了什么?在相同的模型结构中,值不应偏离。

    model1 <- lmer(species1 ~ depth + temperature +  species2 + (1|year) + (1|site/plot), data=data)
    

    您尚未删除上述行中的year,但在summary(M1) 调用中已将其删除。

    我对年份问题的简单回答是肯定的,我会包括年份。在我所看到的任何生物数据集中,每年都如此不同,至少值得将其作为随机截距包括在内 - 就像你所做的那样。如果估计随机效应均值的方差为零,那么这个术语就好像你一开始就没有它一样。此时,如果您仍想考虑数据的分组性质,您可以选择将该随机效应拟合为固定效应。

    另外,这方面有很多资源。一些例子:

    Bolker、Benjamin M.、Mollie E. Brooks、Connie J. Clark、Shane W. Geange、John R. Poulsen、M. Henry H. Stevens 和 Jada-Simone S. White。 "Generalized linear mixed models: a practical guide for ecology and evolution." 生态与进化趋势 24, no. 3 (2009): 127-135。

    Harrison、Xavier A.、Lynda Donaldson、Maria Eugenia Correa-Cano、Julian Evans、David N. Fisher、Cecily ED Goodwin、Beth S. Robinson、David J. Hodgson 和 Richard Inger。 “生态学中混合效应建模和多模型推理的简要介绍。” PeerJ 6(2018):e4794。 https://peerj.com/articles/4794/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-28
      • 2018-10-06
      • 2013-07-12
      • 2014-05-20
      • 2021-04-13
      • 2015-05-01
      • 2011-08-04
      相关资源
      最近更新 更多