psd (version 2.1.0)

pgram_compare: 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 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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab