0

I have 9 degradation curves which I would like to compare and would like advice as to how best to do this. My initial thoughts surrounded comparing non-linear regressions. I will first explain the question and then detail the experimental design a bit more:

My questions are:

  1. how can I compare the rate of degradation between my 9 groups?
  2. how can I determine to what extent my two primary independent variables (type of organic matter and field plot) drive the rate of degradation.

I placed 3 types of organic matter (X, Y, Z) outside in 3 field plots (A, B, C). 12 samples of each organic matter were placed in each plot (36 samples per plot, total 108 samples). I know the original organic matter (OM) (as both a total value and as percentage of dry matter) content for each sample. At 3 time points a week apart (T1, T2, T3) I removed 4 samples of each type from each plot and again measured organic matter content.

So for each of the 9 combinations (AX, AY, AZ, BX, BY, BZ, CX, CY, CZ) I have: 12 measurments of original organic matter at T0 and 4 measurements of organic matter at each of the latter 3 time points (T1, T2, T3).

I hope that I have provided enough information - please ask if I have not. I am very appreciative of any help and advice surrounding this query.

Thank you, and Merry Christmas.

Andrew.

Link to sample date: https://docs.google.com/spreadsheets/d/1a5w9BeeogprKAOwHi3WYSW7JF8EtjQOaaG9z-qzDRgw/pub?output=xlsx

  • 1
    If you have a parametric model for the degradation you could use a non-/linear mixed effects model (see package nlme). Otherwise, you could use a generalized additive mixed model (see package mgcv). However, if you have only four time points, you might be limited to linear (mixed-effects) models. Without data I can't tell you more. I'll cast a vote for migration to stats.stackexchange.com. – Roland Dec 18 '15 at 10:26
  • Thanks Roland, much appreciated. Talking it over in the pub mixed effects models came up in conversation so I think it's definitely an avenue to be persued. I'd have loved to have uploaded the data but am restricted with its use. – Andrew Cooke Dec 18 '15 at 10:32
  • Hi chaps. I have published some sample data via google docs for download as an excel file. https://docs.google.com/spreadsheets/d/1a5w9BeeogprKAOwHi3WYSW7JF8EtjQOaaG9z-qzDRgw/pub?output=xlsx – Andrew Cooke Dec 18 '15 at 11:44

1 Answers1

1

Here is something quick to give you a start. Due to your few time points I would use a linear model. I assume that absolute differences of OM are sensible here, i.e., that samples are normalized in some meaningful way. You might need to work with relative values instead (and could possibly even need a GLMM in that case?).

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

Some people advice only fitting random effects if a larger number of groups is available, but I generally trust also models with few groups if the resulting fit seems reasonable. Of course, you shouldn't put too much trust into the variance estimate of the random effects in such a case. Alternatively, you could treat Plot as a fixed effects, but your model would need two more parameters then. However, usually we are not interested too much in plot differences and prefer to concentrate on treatment effects. 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

Apparently degradation rates before your samplings were different between sample types (see the different intercepts according to sample type), which would mean non-linear rates (as we would expect). A linear model of the differences means constant absolute degradation rates.

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

Roland
  • 127,288
  • 10
  • 191
  • 288
  • Wow. Thanks Roland. The effort is highly appreciated. To address some of the comments and outputs you gave: I can and will look at adding in the Day 0 time point - which I admitedly should have put as a seperate data set. I too was debating relative or total values - I think realtive seem most sensible. This will take me some time to digest - but hopefully I can work with what you've kindly provided. p.s. I noticed on your profile that you're a soil scientist Roland. I'm based at Rothamsted Research in the Sustainable Soils and Grassland Systems group. – Andrew Cooke Dec 18 '15 at 14:04
  • Your group might be in collaboration with some of my colleagues then. – Roland Dec 18 '15 at 14:06