I would like to use discrete Fourier transform to identify dynamic of sales and then cluster similar patterns. However, I'm new in using R and after searching for a solution, I found a prodecure fft(), but not exactly sure if I get the same result as for DFT. I would like to present waves on a plot and then use an algorithm to cluster similar sales dynamics. What's more, I was wondering if I can use procedure fft to transform all time series, not one by one (so suggest R: transform new time series after 26 weeks - look at the database)
http://imageshack.com/a/img854/1958/zlco.jpg piece of my database; three columns: Product - present the group of product Week - time since launch the product (week), first 26 weeks Sales_gain - how the sales of product change by weeks
http://imageshack.com/a/img703/6726/sru7.jpg that's how my time series looks like
I believe that I can use fft() to eventually accomplish this goal however the leap from the output of fft() to my goal is a bit unclear.
Please note that I am relatively new to time series analysis (that's why I cannot put here my code) so any clarity you could provide w.r.t. putting the output of fft() in context, or any package you could recommend that would accomplish this task efficiently would be appreciated
From ancient memory you should square the real part to get the spectrum which gives you the magnitude at each frequency (days in your example)
x = some data
plot(Re(fft(x))^2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With