I'm trying to extract statistical features from power spectral density values in Python. My data is actigraphy data with sampling rate 1/60 Hz (once per minute). This is a sample from my data, "activity" column are actual measurements.
I calculate periodogram without any problem. However, values that I get are huge, e.g. mean of periodogram values is about 10 milions, while variance is about 10e16. Is this normal? Original measurements are typically from range [1, 1000].
However, with large values I can manage, the real problem is that for kurtosis (and only for it) I get infinities and error:
RuntimeWarning: overflow encountered in square s = s**2
If I change my sampling rate to 1 Hz (which is not true, but it's a default value), then I get regular numbers. What can be the cause of this behavior?
Is there a way to safely calculate statistics from periodogram in such cases?
My code:
x = df["activity"].values
psd = scipy.signal.periodogram(x, fs=(1/60))[1]
features = {
"minimum": np.min(X),
"maximum": np.max(X),
"mean": np.mean(X),
"median": np.median(X),
"variance": np.var(X),
"kurtosis": sp.stats.kurtosis(X),
"skewness": sp.stats.skew(X),
"coeff_of_var": sp.stats.variation(X),
"iqr": sp.stats.iqr(X),
"trimmed_mean": sp.stats.trim_mean(X, proportiontocut=0.1),
"entropy": sp.stats.entropy(X, base=2),
}