0
$\begingroup$

Suppose to have two time series with peak signals at different frequencies, like these two:

signal1 <- tsibble(timestamp = t,
                   value = ifelse(seq(1,length(t)) %% 5 == 0, 15, 0))
signal1
# A tsibble: 96 x 2 [1M]
   timestamp value
       <mth> <dbl>
 1  2011 Jan     0
 2  2011 Feb     0
 3  2011 Mar     0
 4  2011 Apr     0
 5  2011 May    15
 6  2011 Jun     0
 7  2011 Jul     0
 8  2011 Aug     0
 9  2011 Sep     0
10  2011 Oct    15
# ... with 86 more rows
signal1 %>% autoplot()

signal1 plot

signal2 <- tsibble(timestamp = t,
                   value = ifelse(seq(1,length(t)) %% 9 == 0, 13, 0))

signal2
# A tsibble: 96 x 2 [1M]
   timestamp value
       <mth> <dbl>
 1  2011 Jan     0
 2  2011 Feb     0
 3  2011 Mar     0
 4  2011 Apr     0
 5  2011 May     0
 6  2011 Jun     0
 7  2011 Jul     0
 8  2011 Aug     0
 9  2011 Sep    13
10  2011 Oct     0
# ... with 86 more rows
signal2 %>% autoplot()

signal2 plot

Joining the two signals we obtain this composite signal:

tsibble(timestamp = t,
        value = signal1$value + signal2$value) %>% autoplot()

composite signal

Now we disturb this composite signal with white noise:

noise <- tsibble(timestamp = t,
                  value = rnorm(length(t), mean=0, sd=10))

final_ts <- tsibble(timestamp = t,
                value = noise$value + signal1$value + signal2$value) 

final_ts %>% autoplot()

final_ts plot

Starting from this noisy time series, I would like to identify the different frequencies of the periodic peak signals buried in the noise, in this case 5/12 and 9/12 (assuming 12 months as the unit of time).

How to do that? Is the Fourier analysis the best way to do that?

My ultimate goal is to reconstruct the time series composed only of the periodic signals.

$\endgroup$
  • $\begingroup$ The reconstruction of the time series composed only of the periodic signals, that's exactly what a Fourier analysis does (when you take it's complex output) $\endgroup$ – V15I0N May 26 '20 at 5:42

Your Answer

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

Browse other questions tagged or ask your own question.