具有随机效应的LMM与交叉/嵌套分组因子的水平有关

时间:2019-01-24 12:12:20

标签: r lme4 random-effects multilevel-analysis

我在理解这个实验是交叉的还是嵌套的分组因子时遇到了问题,我想与LMM中的随机效应相关联。我也想了解模型的语法是否正确。

您将如何处理:该实验设置了三个block复制。其中有三个treatment地块(这些是土壤地块,总共9个)。在每个图中,我有六个点(observations-这代表我的土壤剖面),我在其中收集土壤样本。因此,在observations中,我有三个土壤horizons(这三层土壤来自同一点-observation,但深度不同)。

  1. 我主要想测量同一土壤treatmentshorizon之间的差异。

one_hor是一个缩小的数据帧,其中仅包含一个地平线的mydependvariable: 这是数据帧:

dput(one_hor)
structure(list(myanagem = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 
1L, 2L, 3L), .Label = c("CH", "CHF", "WTH"), class = "factor"), 
    block = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L), .Label = c("1", 
    "2", "3"), class = "factor"), hor = structure(c(3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L), .Label = c("F", "H", "L"), class = "factor"), 
    mydependvariable = c(47.8441491508198, 42.9776016786983, 
    44.2640639539627, 41.5914174334551, 51.6427380254114, 37.5819989709135, 
    49.8987347045142, 41.3728234591754, 52.9627860231326)), row.names = c(NA, 
-9L), class = "data.frame")

为此,我想到了以下模型:

model_lmer_C_L <- lmer(log(mydependvariable) ~  managem + (1|block),
       data= mix_L, REML = TRUE)
  1. 我还想测量同一horizons中的土壤treatment之间的差异(我不知道这是否满足独立性的假设)。为此,我使用了数据框all_hors,该数据框具有各个角度的值:
dput (all_hors)
structure(list(myanagem = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 
1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 
2L, 3L, 1L, 2L, 3L), .Label = c("CH", "CHF", "WTH"), class = "factor"), 
    block = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 
    1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 
    3L, 3L), .Label = c("1", "2", "3"), class = "factor"), hor = structure(c(3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), class = "factor", .Label = c("F", 
    "H", "L")), mydependvariable = c(44.6968250852355, 53.1828782803165, 
    47.4575645657112, 51.5093038256725, 48.1827652837951, 39.9179043777532, 
    50.0989615281406, 41.7977368903542, 43.0292001919997, 50.4325507695009, 
    49.7646553556968, 53.9195107181261, 45.2323395692346, 52.0066022471402, 
    54.3295196086515, 41.7231684901803, 51.211617259873, 48.1669047180151, 
    56.9066150534588, 42.1880849195177, 67.6490806984713, 62.2504530592383, 
    43.5937599989346, 39.4377478805407, 69.1207400428221, 36.5530072488604, 
    42.3732207709937)), row.names = c(NA, -27L), class = "data.frame")

为此,我想到了以下模型:

model_lmer_C <- lmer(log(mydependvariable) ~  treatment * horizon + (1|block/treatment), data = all_hors)

您认为模型的语法正确吗?

我的理解是“治疗”和“障碍”是交叉的,对吗?

我不确定土壤“水平”是否嵌套或交叉在“观测”中(也许只有在我想测量同一“处理”中土壤“水平”之间的差异时才如此)? / p>

0 个答案:

没有答案