Search code examples
rtime-series

Specify time series parameters for data over millions of years


I have foram delta 18O data over 6 million years, with one datapoint every 0.003 Myrs, like this:

Age (Myr) | d18O
  0       | 3.43
  0.003   | 3.37
  0.006   | 3.54
  0.009   | 3.87
  0.012   | 4.36
  0.015   | 4.90
  0.018   | 5.01
  0.021   | 4.96
  0.024   | 4.87
  0.027   | 4.67
  0.03    | 4.58

ts_d18O <- ts(d18O[,2])
plot(ts_d18O)

However, when I tell R to consider it as a time series and I plot it, I get values on the x-axis all the way to 2000, i.e. the scale is not in millions of years. Here's the plot

How do I fix this? I need it to be a time series because I have to do spectral analysis on it, e.g. periodograms


Solution

  • You need to specify the frequency of observations. You have 1 observation every 3000 years, so the frequency would be 1/3000 if you want your answer in years. I'll assume you want your answer in millions of years. This means your frequency is 1/0.003, or 333.333 (i.e. this is how many samples are taken per million years).

    You should specify a start time as well (-5 in this example will represent 5 Mya).

    Finally, you can label your x axis as required.

    ts_d18O <- ts(d18O[,2], start = c(0.003, -5 / 0.003), frequency = 1/0.003)
    ts
    #> Time Series:
    #> Start = -5 
    #> End = -4.97 
    #> Frequency = 333.333333333333 
    #>  [1] 3.43 3.37 3.54 3.87 4.36 4.90 5.01 4.96 4.87 4.67 4.58
    plot(ts_d18O, xlab = "Million years ago")
    

    enter image description here