0
votes

I've got a set of 780 monthly temperature anomalies over 65 years and I want to analyse it for frequencies that are driving the anomalies. I've used the spectrum package to do this, I've included pictures of the series before and after the analysis.

from spectrum import *

p = Periodogram(anomalies, sampling=1/12)
p.run()
plt.title('Power Spectrum of Monthly Temperature Anomalies')
p.plot(marker='.')
plt.show()

The resulting spectrum has several clear negative spikes. Now I understand that a negative value in Db isn't actually a negative absolute value, but why is this happening? Does it imply there's some specific frequency missing from my data? Because a positive spike implies one is present.

Also, why are most of the frequencies displayed negative? What is the reference value for Db to be an amplification of?

A part of me thinks I should be taking the absolute value of this spectrum but I'd like to understand why if that's the case. Also I put in the value for sampling as 1/12 because the data points are monthly so hopefully the frequency scale is in per year?

Many thanks, this is my first post here so let me know if I need to be clearer about anything.

Negative Energies

The Series being Analysed

1

1 Answers

1
votes

As you can see in the plots, on the y-axis, the units are in dB (decibel, https://en.wikipedia.org/wiki/Decibel). so what is see is not the raw data (in the frequency domain) but something like 10*log10(data). This explains the presence of negative values and is perfectly normal.

Here you have positive and negative values but in general, you would normalise the data (by the maximum) so that all values are negative and the highest value is set to 0. This is possible using :

p.plot(norm=True)

You can plot the raw data (without the log function) but you would need to use the raw data (in the frequency domain). For instance to reproduce the behaviour of p.plot function, you can use:

from pylab import plot
plot(p.frequencies(), 10*log10(p.psd/p.psd.max())

So, if you do not want to use the decibel unit, use:

from pylab import plot
plot(p.frequencies(), p.psd)

disclaimer: I'm the main author of Spectrum (http://pyspectrum.readthedocs.io/).