lspec: Lspec: logspline estimation of a spectral distribution

View source: R/polspline.R

lspecR Documentation

Lspec: logspline estimation of a spectral distribution

Description

Fit an lspec model to a time-series or a periodogram.

Usage

lspec(data, period, penalty, minmass, knots, maxknots, atoms, maxatoms,
maxdim , odd = FALSE, updown = 3, silent = TRUE) 

Arguments

data

time series (exactly one of data and period should be specified). If data is specified, lspec first computes the modulus of the fast Fourier transform of the series using the function fft, resulting in a periodogram of length floor(length(data)/2).

period

value of the periodogram for a time series at frequencies \frac{2\pi j}T, for 1\leq j \leq T/2. If period is specified, odd should indicate whether the length of the series T is odd (odd = TRUE) or even (odd = FALSE). Exactly one of data and period should be specified.

penalty

the parameter to be used in the AIC criterion. The method chooses the number of basis functions that minimizes -2 * loglikelihood + penalty * (number of basis functions). Default is to use a penalty parameter of penalty = log(length(period)) as in BIC.

minmass

threshold value for atoms. No atoms having smaller mass than minmass are included in the model. If minmass takes its default value, in 95% of the samples, when data is Gaussian white noise, the model will not contain atoms.

knots

ordered vector of values, which forces the method to start with these knots. If knots is not specified, the program starts with one knot at zero and then employs stepwise addition of knots and atoms.

maxknots

maximum number of knots allowed in the model. Does not need to be specified, since the program has a default for maxdim and the number of dimensions equals the number of knots plus the number of atoms. If maxknots = 1 the fitted spectral density function is constant.

atoms

ordered vector of values, which forces the method to start with discrete components at these frequencies. The values of atoms are rounded to the nearest multiple of \frac{2\pi}T. If atoms is not specified, the program starts with no atoms and then performs stepwise addition of knots and atoms.

maxatoms

maximum number of discrete components allowed in the model. Does not need to be specified, since the program has a default for maxdim and the number of dimensions equals the number of knots plus the number of atoms. If maxatoms = 0 a continuous spectral distribution is fit.

maxdim

maximum number of basis functions allowed in the model (default is \max(15,4\times\mbox{length(period)}^{0.2})).

odd

see period. If period is not specified, odd is not relevant.

updown

the maximal number of times that lspec should go through a cycle of stepwise addition and stepwise deletion until a stable solution is reached.

silent

should printing of information be suppressed?

Value

Object of class lspec. The output is organized to serve as input for plot.lspec (summary plots), summary.lspec (summarizes fitting), clspec (for autocorrelations and autocovariances), dlspec (for spectral density and line-spectrum,) plspec (for the spectral distribution), and rlspec (for random time series with the same spectrum).

call

the command that was executed.

thetap

coefficients of the polynomial part of the spline.

nknots

the number of knots that were retained.

knots

vector of the locations of the knots in the logspline model. Only the knots that were retained are in this vector.

thetak

coefficients of the knot part of the spline. The k-th coefficient is the coefficient of (x-t(k))^3_+.

natoms

the number of atoms that were retained.

atoms

vector of the locations of the atoms in the model. Only the atoms that were retained are in this vector.

mass

The k-th coefficient is the mass at atom[k].

logl

the log-likelihood of the model.

penalty

the penalty that was used.

minmass

the minimum mass for an atom that was allowed.

sample

the sample size that was used, either computed as length(data) or as (2 * length(period)) when odd = FALSE or as (2 * length(period) + 1) when odd = TRUE.

updown

the actual number of times that lspec went through a cycle of stepwise addition and stepwise deletion until a stable solution was reached, or minus the number of times that lspec went through a cycle of stepwise addition and stepwise deletion until it decided to quit.

Author(s)

Charles Kooperberg clk@fredhutch.org.

References

Charles Kooperberg, Charles J. Stone, and Young K. Truong (1995). Logspline Estimation of a Possibly Mixed Spectral Distribution. Journal of Time Series Analysis, 16, 359-388.

Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371–1470.

See Also

plot.lspec, summary.lspec, clspec, dlspec, plspec, rlspec.

Examples

data(co2)
co2.detrend <- unstrip(lm(co2~c(1:length(co2)))$residuals)
fit <- lspec(co2.detrend)

polspline documentation built on Oct. 27, 2023, 1:07 a.m.

Related to lspec in polspline...