Learn R Programming

mvLSWimpute (version 0.1.1)

spec_estimation: Function to estimate the Local Wavelet Spectral matrix for a multivariate locally stationary time series containing missing values

Description

This function estimates the LWS matrix for a multivariate locally stationary time series containing missing values. If the input time series does not contain missing values then spectral estimation is carried out using routines from the mvLSW package.

Usage

spec_estimation(data, interp = "linear")

Value

Returns a mvLSW object containing the estimated LWS matrix.

Arguments

data

Input multivariate time series, matrix of dimension TxP where P is the number of channels and T is the length of the series.

interp

Method of interpolation of NAs in spectrum. Can be "linear" or "spline"; see na_interpolation for more detals. See also note below.

See Also

correct_per, smooth_per, mvEWS, na_interpolation

Examples

Run this code

## Sample bivariate locally stationary time series

set.seed(1)
X <- matrix(rnorm(2 * 2^8), ncol = 2)
X[1:2^7, 2] <- 3 * (X[1:2^7, 2] + 0.95 * X[1:2^7, 1])
X[-(1:2^7), 2] <- X[-(1:2^7), 2] - 0.95 * X[-(1:2^7), 1]
X[-(1:2^7), 1] <- X[-(1:2^7), 1] * 4
X <- as.ts(X)

# create some missing values, taking care to provide some data at the start of the series 

missing.index = sort(sample(10:2^8, 30))

X[missing.index, ] <-NA

# estimate the spectrum

spec = spec_estimation(X)

Run the code above in your browser using DataLab