Search code examples
rtime-seriesdecompositiontrend

R - Trend estimation for short time series


I have very short time series of data from a climatic experiment that I did back in 2012. The data consists of daily water solution flux and daily CO2 flux data. The CO2 flux data comprises 52 days and the water solution flux data is only 7 days long. I have several measurements a day for the CO2 flux data but I calculated daily averages.

Now, I would like to know if there is a trend in these time series. I have figured out that I can use the Kendall trend test or a Theil-Sen trend estimator. I used the Kendall test before for a time series spanning several years. I don't know how to use the Theil-Sen trend estimator.

I put my data into an ts object in R, but when I tried doing a decompositon (using the function decompose) I get the error that the time series is spanning less than 2 periods. I would like to extract the trend data and then do a Mann-Kendall test on it.

Here is the code that I got so far:

myexample <- structure(c(624.27, 682.06, 672.77, 
                     765.96, 759.52, 760.38, 742.81
), .Names = c("Day1", "Day2", "Day3", "Day4", "Day5", "Day6", 
          "Day7"))

ts.object <- ts(myexample, frequency = 365, start = 1)

decomp.ts.obj <- decompose(ts.obj, type = "mult", filter=NULL)

# Error in decompose(ts.obj, type = "mult", filter = NULL)

Can anyone help me on how to do a trend analysis with my very short time series? Any google-fu was to no avail. And, can someone tell me what the size of the Kendall tau means? It spans values from -1 to 1. Is a tau=0.5 a strong or a weak trend?

Thanks, Stefan


Solution

  • I would be tempted to do something simple like

    d <- data.frame(val=myexample,ind=seq(myexample))
    summary(lm(val~ind,d))
    

    or

    library(lmPerm)
    summary(lmp(val~ind,d))
    

    or

    cor.test(~val+ind,data=d,method="kendall")
    

    Whether tau=0.5 is strong or weak depends a lot on context. In this case the p-value is 0.24, which says at least that this signal (based on rank alone) is not distinguishable from an appropriate null signal.