psd-normalization {psd} | R Documentation |
Normalization of power spectral density estimates.
Description
Normalize power spectral densities from various estimators into single-sided spectra.
Usage
normalize(Spec, ...)
## S3 method for class 'list'
normalize(Spec, ...)
## S3 method for class 'spec'
normalize(
Spec,
Fsamp = 1,
src = c("spectrum", "double.sided", "psd", "single.sided"),
verbose = TRUE,
...
)
## S3 method for class 'amt'
normalize(Spec, ...)
Arguments
Spec |
spectrum to normalize |
... |
(unused) additional parameters |
Fsamp |
sampling frequency |
src |
character string; the source of the spectrum estimator |
verbose |
logical; should messages be given? |
Details
Normalizations commonly encountered for power spectra depend on it's assumed sidedness: whether the spectrum is either single- or double-sided. The normalizations performed here enforce single-sidedness, and correct as necessary.
Frequencies are assumed to be based on the Nyquist frequency (half the
sampling rate). For example: If a series X
has sampling frequency F_S
,
then the PSD frequencies will span [0,F_S/2]
.
For amplitudes, improper normalization can can introduce errant factors
of either 1/2 or F_S
into the estimates, depending on the assumed sidedness.
These factors can be accounted for with the src
argument, which defaults to normalizing a double-sided spectrum.
Value
An object with its spectral values normalized accordingly.
Spectrum sidedness and the src
argument
"double.sided"
or "spectrum"
These spectra assume frequency range of [-F_S/2,F_S/2]
, and so are normalized
by scaling by a factor of two upwards.
Some estimators producing double-sided spectra:
stats::spectrum
RSEIS::mtapspec
"single.sided"
or "psd"
As mentioned before,
these spectra assume frequency range of [0,F_S/2]
and
are scaled only by the inverse of the sampling rate.
Some estimators producing single-sided spectra:
Author(s)
A.J. Barbour
See Also
Examples
## Not run: #REX
library(psd)
##
## Normalization
##
# timeseries with sampling frequency **not** equal to 1:
set.seed(1234)
X <- ts(rnorm(1e3), frequency=20)
# spec.pgram: double sided
pgram <- spectrum(X)
# psdcore: single sided
PSD <- psdcore(X)
# note the normalization differences:
plot(pgram, log="dB", ylim=c(-40,10))
plot(PSD, add=TRUE, col="red", log="dB")
# A crude representation of integrated spectrum:
# should equal variance of white noise series (~= 1)
mean(pgram[['spec']]) * max(pgram[['freq']])
mean(PSD[['spec']]) * max(PSD[['freq']])
# normalize
pgram <- normalize(pgram, src="spectrum")
PSD <- normalize(pgram, src="psd")
# replot them
plot(pgram, log="dB", ylim=c(-40,10))
plot(PSD, add=TRUE, col="red", log="dB")
# Again, integrated spectrum should be ~= 1:
mean(pgram[['spec']]) * max(pgram[['freq']])
mean(PSD[['spec']]) * max(PSD[['freq']])
## End(Not run)#REX