# Selecting Appropriate Analyses for Time-Series Data in R

I'm working on an analysis of leaf litter decomposition, which was done with two separate microcosm experiments.

Example dataset:

df <- data.frame(Treatment = c(rep("Control",15),rep("B",15),rep("H",15),rep("M",15)),
Replicate = rep(c(rep(1,5), rep(2,5),rep(3,5)),4),
Day       = rep(c(0, 1, 2, 7, 14),12),
Prop.Mass = c(rep(NA, 15),  1.000, 0.934, 0.923, 0.905, 0.890, 1.000, 0.928, 0.923,
0.907, 0.899, 1.000, 0.938, 0.933, 0.900, 0.892, 1.000, 0.960, 0.939,
0.849, 0.742, 1.000, 0.942, 0.937, 0.841, 0.751, 1.000, 0.957, 0.945,
0.854, 0.749, 1.000, 0.744, 0.704, 0.647, 0.644, 1.000, 0.736, 0.693,
0.660, 0.637, 1.000, 0.721, 0.683, 0.668, 0.651),
Cond      = c(487, 478, 471, 470, 477, 484, 461, 471, 474, 481, 488, 479, 471, 473, 480,
488, 497, 499, 515, 519, 486, 497, 500, 550, 552, 488, 497, 500, 515, 523,
488, 524, 517, 506, 519, 489, 525, 516, 507, 519, 488, 525, 516, 504, 517,
490, 496, 501, 514, 521, 486, 487, 489, 498, 505, 488, 485, 488, 495, 502),
pH        = c(8.54, 6.80, 6.88, 6.79, 6.82, 8.53, 6.85, 6.91, 6.77, 6.70, 8.61, 6.81,
6.88, 6.87, 6.62, 8.47, 7.18, 7.05, 6.34, 6.38, 8.60, 7.49, 7.10, 6.43,
6.35, 8.33, 7.35, 7.06, 6.36, 5.86, 8.42, 6.65, 6.57, 6.36, 5.70, 8.08,
6.47, 6.46, 6.50, 5.76, 8.23, 6.52, 6.48, 6.38, 5.81, 8.59, 8.25, 8.14,
8.13, 7.94, 8.58, 8.32, 8.34, 8.17, 8.13, 8.06, 8.02, 8.17, 8.11, 8.16),
B         = c(rep(0,15), rep(1,15), rep(0,30)), # B dummy variable
H         = c(rep(0,30), rep(1,15), rep(0,15)), # H dummy variable
M         = c(rep(0,45), rep(1,15))             # M dummy variable

)


The first experiment evaluated mass loss over time for three 3 treatments (B, H, M); there were 45 microcosms/samples in total (3 Treatment x 3 Replicate x 5 Day). On each day, samples were removed from microcosms and the proportion of mass remaining was calculated (Prop.Mass).

Due to the low number of replicates, I was originally advised to run a Kruskal-Wallis test on the decomposition constants per treatment; however, "replicates" between days are unrelated (ie For Treatment B: Rep 1 on Day 1 is not the same sample as Rep 1 on Day 7).

Would it instead be more appropriate to conduct linear regressions of log-transformed mass with dummy variables? eg:

summary( lm( log(Prop.Mass) ~ Day * (H+M), data = df ) ) # compares B-H & B-M
summary( lm( log(Prop.Mass) ~ Day * (B+M), data = df ) ) # compares H-M (and B-H again)



The second experiment had 4 treatments (Control, B, H, M) with repeated sampling of microcosm water chemistry; this only used 12 microcosms (4 Treatment x 3 Replicate) which were each sampled at all the times. I initially wanted to use repeated-measures ANOVAs, but have been advised that a non-parametric analysis, such as Friedman Test, may be more appropriate due to the small sample size and loss of some data collected for other metrics (ie unequal replication of some treatments on some days).

Are these appropriate analyses and syntax?

library(rstatix)

# Friedman Test (on mean of daily treatment)
df %>%
dplyr::group_by(Treatment, Day) %>%
dplyr::summarise(pH = mean(pH)) %>%
dplyr::ungroup() %>%
rstatix::friedman_test(pH ~ Treatment | Day)

# Post-Hoc Pairwise Wilcox Test
df %>%
rstatix::wilcox_test(pH ~ Treatment) %>%