pgram_compare: Compare multitaper spectrum with cosine-tapered periodogram

View source: R/func_psdcore.R

pgram_compareR Documentation

Compare multitaper spectrum with cosine-tapered periodogram

Description

Plot the results of psdcore against the results of spec.pgram

Usage

pgram_compare(x, ...)

## S3 method for class 'amt'
pgram_compare(
  x,
  f = NULL,
  X = NULL,
  log.freq = TRUE,
  db.spec = TRUE,
  taper = 0.2,
  ...
)

Arguments

x

a single psdcore object

...

additional parameters (currently unused)

f

numeric; the frequency range to plot; optional: if not given the program will show the entire band.

X

object used to create x; optional: if not given the program will try and access the last copy in the environment. An attempt is made to coerce to an object of class 'ts'.

log.freq

logical; should frequencies be transformed with log10? Note that if f is given, the values should not already be transformed.

db.spec

logical; should the spectrum estimates be converted to decibels with dB?

taper

numeric; specifies the proportion of data to taper for the cosine periodogram.

Value

A list with the cosine-tapered estimates and the adaptive estimates, invisibly.

Examples

set.seed(1234)
X <- rnorm(1e3)

# multitaper spectrum
p <- psdcore(X, ntaper=10)

# how does it compare to a single-cosine tapered spectrum?
pgram_compare(p)

# or in a certain band
pgram_compare(p, c(0.1,0.4))

# linear frequencies
pgram_compare(p, c(0.1,0.4), log.freq = FALSE)

abarbour/psd documentation built on Aug. 15, 2023, 8:56 a.m.