# How to test for differences in gradient between time-series

I have time-series data where I've generated measurements of the same variable using different techniques, for a group of samples.

An example of my data looks like this:

Sample    Technique    Time_point    Variable
1            A             0        14.5
2            A             0        13.5
1            A             1        14.7
2            A             1        15.4


I have six different samples - these were divided into four and subjected to four different techniques. I have measurements from around 50 time points.

I want to test which technique is most reliable - i.e. for which technique do my measurements for my Variable remain closest to those taken at Time_point zero.

I started by subtracting the measurements at time-point zero from each subsequent time-point - my thinking was that this would mean variation between samples would be accounted for. To demonstrate what I mean, the four values in the example table above would now be: 0, 0, 0.2, 1.9

I then used linear model (Variable ~ Time) to look at how the measurements change over time. Doing this I can see that the regression coefficient differs between the treatment, and which treatment looks best. However, I can't think how to test for a statistical difference between the treatments. Any help would be much appreciated.

EDIT:

Here's a dput of a slice of the actual data - everything for Time_point 1. As I said, there are about 50 Time_points, including zero.

structure(list(Sample = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L),
Technique = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L,
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L
), .Label = c("A", "B", "C", "D"), class = "factor"), Time_point = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), Variable = c(0.310926466,
0.92436022, 0.859052911, 0.461566996, 0.573988696, 0.322502093,
0.547209977, 0.056521271, 0.917202812, 0.547052115, 0.966242263,
0.201885797, 0.105904834, 0.032739442, 0.267122038, 0.077291406,
0.1663824, 0.76340688, 0.643163407, 0.368830206, 0.009501023,
0.628387174, 0.108224747, 0.178916308)), class = "data.frame", row.names =
c(NA,
-24L), .Names = c("Sample", "Technique", "Time_point", "Variable"
))

• Can you post your whole data using dput()? Also, your current method estimates the slope, but if there is no slope over time then this is not very informative. It may be more informative to test the mean, or SD? Sep 13, 2019 at 8:44
• @user2974951 The dput output is too long to post here - there are 50 time points for each sample/Technique. I tried to describe the data and give an example - I'm happy to clarify if it's not clear?
– rw2
Sep 13, 2019 at 11:30
• Can you post a small complete subset of your data then? As I said, I would either test the mean or the SD of the differences. Sep 13, 2019 at 11:44
• @user2974951 I added a dput of a subset - everything for time-point 1
– rw2
Sep 13, 2019 at 13:56
• So you have one measurement at time 0 which you take to be the truth / reference. And I am assuming that you claim this value should not change over time? Then you use a different method to obtain 49 more values for 49 different time points? Now you want to test which technique remained closest to the truth? By time point? Or in total? Sep 18, 2019 at 11:11