Learn R Programming

bspec (version 1.6)

one.sided: Conversion between one- and two-sided spectra

Description

Functions to convert between one- and two-sided bspec objects.

Usage

one.sided(x, ...)
two.sided(x, ...)
# S3 method for bspec
one.sided(x, ...)
# S3 method for bspec
two.sided(x, ...)

Arguments

x

a bspec object.

...

currently unused.

Value

A bspec object (see the help for the bspec function).

Details

The conversion only means that the $two.sided element of the returned bspec object is set correspondingly, as internally always the same (one-sided) spectrum is used.

See Also

bspec

Examples

Run this code
# NOT RUN {
lhspec <- bspec(lh)

# compare distributions visually:
par(mfrow=c(2,1))
  plot(lhspec)
  plot(two.sided(lhspec))
par(mfrow=c(1,1))

# ...and numerically:
print(cbind("frequency"=lhspec$freq,
            "median-1sided"=quantile(lhspec,0.5),
            "median-2sided"=quantile(two.sided(lhspec),0.5)))
# }

Run the code above in your browser using DataLab