Class "Spectrum"
      
      Spectrum-class.RdObjects from class "Spectrum" spectra computed by
  spectrum.
Arguments
- x
- a - "Spectrum"object.
- y
- not used but same as - from
- from,to
- interval of frequencies to plot, defaults to \([0,1/2]\). 
- n
- number of points to plot (for the plot method), number of points to look at for the peaks and troughs (print method). 
- standardize
- if - TRUEmake the spectral density integrate to one (i.e., be a probability density function).
- log
- if - log = "y"plot the logarithm of the spectral density, see- ?plot.default.
- main
- a character string, the title of the plot. 
- xlab
- a character string, the label for the x-axis. 
- ylab
- 
a character string, the label for the y-axis. If NULL, the default, the label is set to"Spd"or"log(Spd)", depending on the value of argumentlog.
- ...
- 
for print, further arguments forprint.default();for plot, further arguments forcurve.
Details
"Spectrum" is an S4 class and as such autoprinting calls the
  "Spectrum" method for show(), which prints and
  plots. show has a single argument, the object.  For more
  control over printing, call print which has additional
  arguments. Similarly, call plot for more flexible graphics.
print(object) (i.e., without further arguments) is equivalent
  to show(object), except that the former returns object
  while the latter returns NULL (both invisibly), as is standard
  for these functions.  If print is called with further
  arguments. the spectrum is not plotted.
The peaks and throughs printed by print are computed by
  evaluating the spectral density at n equially spaced points and
  recording the maxima of the resulting discrete sequence. Set argument
  n to get a finer/coarser grid or to force calculations for
  particular frequencies. For example, a multiple of 12 may be suitable
  for n if the data is monthly.
Except for x and standardize the arguments of the
  plot method are as for curve. With the default
  standardize = TRUE the spectral density integrates to one over
  one whole period (usually \((-1/2, 1/2]\) but due to its symmetry it
  is usually plotted over the second half of that interval.
Objects from the Class
Objects contain spectra produced by sarima::spectrum,
  see spectrum for details.
Objects can also be created by calling "new" but this is not
  recommended and currently considered internal.
Slots
- .Data:
- Object of class - "function"~~
- call:
- Object of class - "call"~~
- model:
- Object of class - "ANY", the underlying model.
Methods
- plot
- signature(x = "Spectrum", y = "ANY"): plots- x.
- show
- signature(object = "Spectrum"):- plots - objectand prints succinct information about it, including the peaks and troughs in the spectral density. It is equivalent to calling- printand- plotwith a single argument, see section ‘Details’.
See also
spectrum for details and further examples,
ArmaSpectrum for ARMA spectra
Examples
## ARFIMA(0,d,0) with parameters 'freq' and 'd'
spARFIMA0d0 <- function(freq){  sigma2 / (2 * sin(2*pi*freq/2)^(2 * d)) }
sp <- spectrum(spARFIMA0d0, param = list(sigma2 = 1, d = 0.2))
print(sp, digits = 4)
#> 
#> 
#> Peaks:
#>      freq spec period
#> [1,]    0  Inf      0
#> 
#> Troughs:
#> 
#>      freq spec period
#> [1,]  0.5  0.5      2
#> 
#> max peak/min trough:
#> 	Inf
#> 
## evaluate the spd at selected frequencies 
sp(c(0:4 / 8))
#> [1]       Inf 0.7342334 0.5743492 0.5160881 0.5000000
## argument 'freq' doesn't need to be called 'freq' but it needs to be
##   the first one. This is equivalent to above:
spARFIMA0d0b <- function(x){  sigma2 / (2 * sin(2*pi*x/2)^(2 * d)) }
spb <- spectrum(spARFIMA0d0b, param = list(sigma2 = 1, d = 0.2))
plot(spb)
 ## An example without parameters, as above with sigma2 = 1, d = 0.2 hard
##   coded:
spARFIMA0d0c <- function(freq){  1 / (2 * sin(2*pi*freq/2)^(2 * 0.2)) }
spc <- spectrum(spARFIMA0d0c)
print(spc, digits = 4)
#> 
#> 
#> Peaks:
#>      freq spec period
#> [1,]    0  Inf      0
#> 
#> Troughs:
#> 
#>      freq spec period
#> [1,]  0.5  0.5      2
#> 
#> max peak/min trough:
#> 	Inf
#> 
spc(c(0:4 / 8))
#> [1]       Inf 0.7342334 0.5743492 0.5160881 0.5000000
all.equal(spc(c(0:4 / 8)), sp(c(0:4 / 8))) # TRUE
#> [1] TRUE
## An example without parameters, as above with sigma2 = 1, d = 0.2 hard
##   coded:
spARFIMA0d0c <- function(freq){  1 / (2 * sin(2*pi*freq/2)^(2 * 0.2)) }
spc <- spectrum(spARFIMA0d0c)
print(spc, digits = 4)
#> 
#> 
#> Peaks:
#>      freq spec period
#> [1,]    0  Inf      0
#> 
#> Troughs:
#> 
#>      freq spec period
#> [1,]  0.5  0.5      2
#> 
#> max peak/min trough:
#> 	Inf
#> 
spc(c(0:4 / 8))
#> [1]       Inf 0.7342334 0.5743492 0.5160881 0.5000000
all.equal(spc(c(0:4 / 8)), sp(c(0:4 / 8))) # TRUE
#> [1] TRUE