Learn R Programming

psd (version 0.4-1)

psd-normalization: Normalization of power spectral density estimates.

Description

Normalize power spectral densities from various estimators into single-sided spectra.

Usage

normalize(Spec, Fsamp = 1, src = NULL, verbose = TRUE, ...)

## S3 method for class 'default': normalize(Spec, Fsamp = 1, src = NULL, verbose = TRUE, ...)

## S3 method for class 'list': normalize(Spec, Fsamp = 1, src = NULL, verbose = TRUE, ...)

## S3 method for class 'spec': normalize(Spec, Fsamp = 1, src = NULL, verbose = TRUE, ...)

Value

  • An object with its spectral values normalized accordingly.

Spectrum sidedness and the <code>src</code> 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{} }

subsection

"single.sided" or "psd"

eqn

$[0,F_S/2]$

itemize

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.

See Also

psdcore, spectral_properties

Examples

Run this code
#RDEX#\dontrun{
require(psd)
##
## Normalization
##
set.seed(1234)
# timeseries with sampling frequency **not** equal to 1:
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 objects with class 'spec'
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)
#
#RDEX#}

Run the code above in your browser using DataLab