as.tapers {psd} | R Documentation |
Coerce an object into a 'tapers'
object.
Description
In a tapered spectrum estimation algorithm, it is necessary to enforce rules on the number of tapers that may be applied.
Usage
as.tapers(
x,
min_taper = 1,
max_taper = NULL,
setspan = FALSE,
record.last = FALSE
)
tapers(
x,
min_taper = 1,
max_taper = NULL,
setspan = FALSE,
record.last = FALSE
)
Arguments
x |
An object to set |
min_taper |
Set all values less than this to this. |
max_taper |
Set all values greater than this to this. |
setspan |
logical; should the tapers object be passed through |
record.last |
logical; should the |
Details
Formal requirements enforced by this function are:
Non-zero.
Integer values.
Fewer than the half-length of the spectrum.
For example, we cannot apply zero tapers (the result would be a raw periodogram) or one million tapers (that would be absurd, and violate orthogonality conditions for any series less than two million terms long!).
An object with S3 class 'tapers'
is created;
this will have
a minimum number of tapers in each position
set by min_taper
, and
a maximum number of tapers in each position
set by max_taper
.
If minspan=TRUE
, the bounded taper is fed through minspan
which will restrict the maximum tapers to less than or equal to
the half-length of the spectrum.
Various classes can be coerced into a 'tapers'
object; those
tested sofar include: scalar, vector, matrix, data.frame,
and list.
Multiple objects are concatenated into a single vector dimension.
Enabling setspan
will only override
max_taper
should it be larger than the half-width of the series.
Value
An object with class 'taper'
Note
No support (yet) for use of min_taper,max_taper
as vectors, although
this could be quite desirable.
Author(s)
A.J. Barbour
See Also
Examples
## Not run: #REX
library(psd)
##
## Objects with class 'tapers'
##
is.tapers(as.tapers(1))
is.tapers(as.tapers(1:10))
# note dimensions
as.tapers(matrix(1:10,ncol=1))
as.tapers(list(x=1:10,y=1:30))
as.tapers( x <- data.frame(x=1:10,y=10:19) )
# change constraints
as.tapers(x, min_taper=3, max_taper=10)
# class 'character' is in-coercible; raise error
try(as.tapers(c("a","b")), silent=TRUE)
## End(Not run)#REX