pTimEv: Model stationnary testing

View source: R/pTimEv.R

pTimEvR Documentation

Model stationnary testing

Description

Estimate the parameters variations of a model of canonical form considering a sliding window on an external dataset.

Usage

pTimEv(
  TS,
  nVar,
  dMax,
  TSdate,
  whatTerms = NULL,
  weight = NULL,
  wlength = 1000,
  onestep = 100,
  removeExtr = 1
)

Arguments

TS

The time series to be tested

nVar

Number of variables considered in the polynomial formulation.

dMax

Maximum degree of the polynomial formulation.

TSdate

The time vector

whatTerms

The terms to be considered in the analysis. Note that these are organised following the convention defined by poLabs(nVar,dMax). Since only the structure is required, if coefficients are provided, these are transformed to 1.

weight

A vector providing the binary weighting function of the input data series (0 or 1). By default, all the values are set to 1.

wlength

The window length

onestep

Step length between two estimations

removeExtr

Ratio of estimated values to be removed (if chosen equal to 0.1, only 90 disersion will be kept)

Value

A list containing:

$slidingoutGM An n*(pMax+1) matrix presenting the pMax estimated parameters p1(t), p2(t) etc. column by column. The residual signal epsilon(t) is provided in the last (i.e. pMax + 1) column. Each line correspond to one date provided in $TSdate

$TSdate A time vector relating to the estimates presented in $slidingoutGM

$W A vector providing the output values that can kept (=1) or must be removed (=0)

$whatTerms A vector recalling the terms taken into account in the analysis (their order refers to poLabs(nVar,dMax) function)

$param A vector with the parameter values used to apply the function: nVar, dMax, wlength, onestep, removeExtr

Author(s)

Sylvain Mangiarotti

See Also

autoGPoMoSearch, gPoMo, poLabs

Examples

#Example
data(TS)
plot(TS[,1], TS[,2], type='l')
nVar <- 3
dMax <- 2
pMax <- choose(nVar+dMax,dMax)
whatTerms <- c(1,1,0,1,1,1,1,1,1,1)
 
# apply pTimEv
statio <- pTimEv(TS[,2], nVar, dMax, TS[,1], whatTerms = whatTerms, 
                 wlength = 1000, onestep = 20, removeExtr = 0.15)
# Plot the results
dev.new()
  layout(matrix(1:12, nrow=4, ncol=3, byrow = TRUE))
  what <- which(statio$whatTerms!=0)
  for (i in what) {
      plot(statio$TSdate[statio$W==1], statio$slidingoutGM[statio$W==1,i],
           xlab='TSdate', ylab='coeff', main=poLabs(nVar,dMax)[i])
     }
  plot(statio$TSdate[statio$W==1], statio$slidingoutGM[statio$W==1,pMax+1],
       xlab='date', ylab='Epsilon', main='Resid', log = 'y')
       

GPoM documentation built on July 9, 2023, 6:23 p.m.