比较率 - 曲线和降级

时间:2015-12-18 10:16:43

标签: r statistics spss minitab minitab-16

我有9条退化曲线,我想比较一下,并希望了解如何做到最好。我最初的想法包括比较非线性回归。我将首先解释这个问题,然后再详细介绍一下实验设计:

我的问题是:

  1. 如何比较我的9组之间的降解率?
  2. 我怎样才能确定我的两个主要自变量(有机质和场图的类型)在多大程度上推动了退化速度。
  3. 我在3个田间地块(A,B,C)中放置了3种有机物质(X,Y,Z)。在每个图中放置12个每种有机物样品(每个样品36个样品,总共108个样品)。我知道每个样品的原始有机物(OM)(作为总值和干物质的百分比)含量。在每周3个时间点(T1,T2,T3),我从每个图中删除了每种类型的4个样本,并再次测量了有机物含量。

    因此,对于9种组合(AX,AY,AZ,BX,BY,BZ,CX,CY,CZ)中的每一种,我都有: 在T0处测量12次原始有机物,在后3个时间点(T1,T2,T3)测量4次有机物质。

    我希望我提供了足够的信息 - 请问我是否有。我非常感谢有关此查询的任何帮助和建议。

    谢谢,圣诞快乐。

    安德鲁。

    链接到样本日期: https://docs.google.com/spreadsheets/d/1a5w9BeeogprKAOwHi3WYSW7JF8EtjQOaaG9z-qzDRgw/pub?output=xlsx

1 个答案:

答案 0 :(得分:1)

这是一个快速给你开始的东西。由于你的时间点很少,我会使用线性模型。我假设OM的绝对差异在这里是明智的,即样本以某种有意义的方式归一化。您可能需要使用相对值(在这种情况下甚至可能需要GLMM?)。

library(data.table)
DT <- fread("Untitled spreadsheet.csv")
setnames(DT, make.names(names(DT)))
DT[, DiffOM := OM.at.collection..g. - Original.OM..T0...g.]
DT <- DT[-1]

library(ggplot2)
p <- ggplot(DT, aes(x = Day.of.collection, y = DiffOM, color = Plot)) +
  geom_point() +
  facet_wrap(~ Sample.type, ncol = 1)
print(p)

plot1

如果可以获得更多的群体,有些人建议仅适合随机效应,但如果结果看起来合理,我通常也会信任具有少数群体的模型。当然,在这种情况下,您不应过分信任随机效应的方差估计。或者,您可以将Plot视为固定效果,但您的模型则需要另外两个参数。然而,通常我们对情节差异不太感兴趣,而更愿意专注于治疗效果。 YMMV。

library(lmerTest)

fit1 <- lmer(DiffOM ~ Day.of.collection * Sample.type + (1 | Plot), data = DT)
fit2 <- lmer(DiffOM ~ Day.of.collection * Sample.type + (Day.of.collection | Plot), data = DT)
lme4:::anova.merMod(fit1, fit2)
#random slope doesn't really improve the model

fit3 <- lmer(DiffOM ~ Day.of.collection * Sample.type + (Sample.type | Plot), data = DT)
lme4:::anova.merMod(fit1, fit3)
#including the Sample type doesn't either

summary(fit1)
#apparently the interactions are far from significant

fit1a <- lmer(DiffOM ~ Day.of.collection + Sample.type + (1 | Plot), data = DT)
lme4:::anova.merMod(fit1, fit1a)
plot(fit1a)
#seems more or less okay with possibly exception of small degradation
#you could try a variance structure as implemented in package nlme

anova(fit1a)
#Analysis of Variance Table of type III  with  Satterthwaite 
#approximation for degrees of freedom
#                  Sum Sq Mean Sq NumDF DenDF F.value    Pr(>F)    
#Day.of.collection 3909.4  3909.4     1   102 222.145 < 2.2e-16 ***
#Sample.type        452.4   226.2     2   102  12.853 1.051e-05 ***
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

显然,样品类型之间的降解率在样品类型之间是不同的(根据样品类型参见不同的截距),这将意味着非线性速率(正如我们所期望的那样)。差异的线性模型意味着恒定的绝对降解率。

summary(fit1a)

newdat <- expand.grid(Day.of.collection = seq(28, 84, by = 1), 
                      Plot = c("A", "B", "C"), 
                      Sample.type = c("X", "Y", "Z"))
newdat$pred <- predict(fit1a, newdata = newdat)
newdat$pred0 <- predict(fit1a, newdata = newdat, re.form = NA)

p +
  geom_line(data = newdat, aes(y = pred, size = "subjects")) +
  geom_line(data = newdat, aes(y = pred0, size = "population", color = NULL)) +
  scale_size_manual(name = "Level",
                    values = c("subjects" = 0.5, "population" = 1.5))

plot2