pilot_spec: Calculate inital power spectral density estimates

Description Usage Arguments Details Value Removing an AR effect from the spectrum Author(s) See Also Examples

View source: R/func_pilot.R

Description

This PSD is used as the starting point – the pilot spectrum – for the adaptive estimation routine.

Usage

1
2
3
4
5
6
7
8
pilot_spec(x, ...)

## S3 method for class 'ts'
pilot_spec(x, ...)

## Default S3 method:
pilot_spec(x, x.frequency = NULL, ntap = NULL,
  remove.AR = NULL, plot = FALSE, verbose = FALSE, ...)

Arguments

x

vector; the data series to find a pilot spectrum for

...

additional parameters passed to psdcore

x.frequency

scalar; the sampling frequency (e.g. Hz) of the series

ntap

scalar; the number of tapers to apply during spectrum estimation

remove.AR

scalar; the max AR model to be removed from the data.

plot

logical; should a plot be created?

verbose

logical; should messages be given?

Details

A fixed number of tapers is applied across all frequencies using psdcore, and subsequent taper-refinements are based on the spectral derivatives of this spectrum; hence, changes in the number of tapers can affect how many adaptive stages may be needed (though there are no formal convergence criteria to speak of).

The taper series of the returned spectrum is constrained using as.tapers(..., minspan=TRUE).

The default behaviour (remove.AR <= 0) is to remove the standard linear model [f(x) = α x + β] from the data; however, the user can model the effect of an autoregressive process by specifiying remove.AR.

Value

An object with class 'spec', invisibly, and "pilot_psd" in the working environment.

Removing an AR effect from the spectrum

If remove.AR > 0 the argument is used as AR.max in prewhiten, from which an AR-response spectrum is calculated using the best fitting model.

If the value of remove.AR is too low the spectrum could become distorted, so use with care. Note, however, that the value of remove.AR will be restricted to within the range [1,100]. If the AR order is much larger than this, it's unclear how prewhiten will perform and whether the AR model is appropriate.

Note that this function does not produce a parametric spectrum estimation; rather, it will return the amplitude response of the best-fitting AR model as spec.ar would. Interpret these results with caution, as an AR response spectrum can be misleading.

Author(s)

A.J. Barbour

See Also

psdcore, prewhiten, spec.ar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: #REX
library(psd)

##
## Pilot spectrum
##

data(magnet)

## simply calculate the pilot spectrum with a few tapers
plot(pilot_spec(xc <- magnet$clean), log="dB", 
     main="Pilot PSDs for MAGNET and its AR-innovations (red)")

## remove the effect of an AR model
# note: remove.AR -- the max AR model to be removed from the data
plot(pilot_spec(xc, remove.AR=10), log="dB", add=TRUE, col="red")


## End(Not run)#REX

williamdeleo/psd documentation built on May 29, 2019, 11:58 a.m.