I measured number of mass spectra peaks from differently fixated material to test for an effect of fixation on number of peaks. I made weekly measurements to see the change over time for 3 Months, which is a relevant time scale for us. From the raw data I calculated median values as I want to test the resulting slope using MannKendall and TheilSen Estimator. To do so, I have to specify the data as a Time Series object. But as I only have 13 observations, I am not sure what frequency to use in ts(). I already tested if the frequency has an influence on results and it is enormous.

This is an example of my data:

Week  Meadian_peaks
 0     113
 1     111
 2     110
 3     112
 4     110.25
 5     108.5
 6     105.25
 7     102
 8     103.2
 9     104.4
 10    105.60
 11    106.8
 12    108

I specified the time series with weekly frequency:

ts_X25100all = ts(X25100all$Meadian_peaks, frequency = 52, start = 1, end = 13) 
#tau = -0.00614, 2-sided pvalue =0.82478

This result tells me, that there is now significant difference of the slope to zero.

Specifying the time series with frequency = 1 (yearly) the result is quite different:

ts_X25100all = ts(X25100all$Meadian_peaks, frequency = 1, start = 1, end = 13) 
#tau = -0.462, 2-sided pvalue =0.032736

This is why I want to know, what frequency I have to choose. I am a bit in struggle because I understood that based on the frequency a seasonality is described - which, to my understanding, I do not have in my data.

The example I provide here is a well fixated sample resulting in only minor differences over time. I have others that I want to compare with this one which is why I want to test for monotonic trend. My raw data does not allow an ANCOVA. I already tested different linear models and data transformations. Residuals were never normal distributed. Just in case you would like to suggest this.

So my question is: Which frequency to use for my data?

Best regards


1 Answer 1


In ts function, start and end parameters are reserved for including the time. For instance if your data starts at the 1st week of 2017 and ends in the 13th week of 2017 the parameters should be: start = c(2017,1) and end = c(2017,13). The frequency should be 52 since you are working with weekly data.

  • $\begingroup$ Thank you for your answer K. Aykurt. It really seems that this was the mistake. Thank you so much. $\endgroup$
    – S.R.
    Dec 13, 2017 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.