gmwm: Generalized Method of Wavelet Moments (GMWM) for IMUs, ARMA,...

Description Usage Arguments Details Value Examples

View source: R/GMWM.R

Description

Performs estimation of time series models by using the GMWM estimator.

Usage

1
2
3
gmwm(model, data, model.type = "imu", compute.v = "auto",
  robust = FALSE, eff = 0.6, alpha = 0.05, seed = 1337, G = NULL,
  K = 1, H = 100, freq = 1)

Arguments

model

A ts.model object containing one of the allowed models.

data

A matrix or data.frame object with only column (e.g. N x 1 ), a lts object, or a gts object.

model.type

A string containing the type of GMWM needed: "imu" or "ssm".

compute.v

A string indicating the type of covariance matrix solver. Valid values are: "fast", "bootstrap", "diag" (asymptotic diag), "full" (asymptotic full). By default, the program will fit a "fast" model.

robust

A boolean indicating whether to use the robust computation (TRUE) or not (FALSE).

eff

A double between 0 and 1 that indicates the efficiency.

alpha

A double between 0 and 1 that correspondings to the alpha/2 value for the wavelet confidence intervals.

seed

An integer that controls the reproducibility of the auto model selection phase.

G

An integer to sample the space for IMU and SSM models to ensure optimal identitability.

K

An integer that controls how many times the bootstrapping procedure will be initiated.

H

An integer that indicates how many different samples the bootstrap will be collect.

freq

A double that indicates the sampling frequency. By default, this is set to 1 and only is important if GM() is in the model

Details

This function is under work. Some of the features are active. Others... Not so much.

The V matrix is calculated by: diag[(Hi-Lo)^2].

The function is implemented in the following manner: 1. Calculate MODWT of data with levels = floor(log2(data)) 2. Apply the brick.wall of the MODWT (e.g. remove boundary values) 3. Compute the empirical wavelet variance (WV Empirical). 4. Obtain the V matrix by squaring the difference of the WV Empirical's Chi-squared confidence interval (hi - lo)^2 5. Optimize the values to obtain theta^hat 6. If FAST = TRUE, return these results. Else, continue.

Loop k = 1 to K Loop h = 1 to H 7. Simulate xt under F_theta^hat 8. Compute WV Empirical END 9. Calculate the covariance matrix 10. Optimize the values to obtain theta^hat END 11. Return optimized values.

The function estimates a variety of time series models. If type = "imu" or "ssm", then parameter vector should indicate the characters of the models that compose the latent or state-space model. The model options are:

"AR1"

a first order autoregressive process with parameters phi, sigma^2

"GM"

a guass-markov process beta, sigma[gm]^2

"ARMA"

an autoregressive moving average process with parameters phi[p], theta[q], sigma^2

"DR"

a drift with parameter omega

"QN"

a quantization noise process with parameter Q

"RW"

a random walk process with parameter sigma^2

"WN"

a white noise process with parameter sigma^2

If only an ARMA() term is supplied, then the function takes conditional least squares as starting values If robust = TRUE the function takes the robust estimate of the wavelet variance to be used in the GMWM estimation procedure.

Value

A gmwm object with the structure:

estimate

Estimated Parameters Values from the GMWM Procedure

init.guess

Initial Starting Values given to the Optimization Algorithm

wv.empir

The data's empirical wavelet variance

ci.low

Lower Confidence Interval

ci.high

Upper Confidence Interval

orgV

Original V matrix

V

Updated V matrix (if bootstrapped)

omega

The V matrix inversed

obj.fun

Value of the objective function at Estimated Parameter Values

theo

Summed Theoretical Wavelet Variance

decomp.theo

Decomposed Theoretical Wavelet Variance by Process

scales

Scales of the GMWM Object

robust

Indicates if parameter estimation was done under robust or classical

eff

Level of efficiency of robust estimation

model.type

Models being guessed

compute.v

Type of V matrix computation

augmented

Indicates moments have been augmented

alpha

Alpha level used to generate confidence intervals

expect.diff

Mean of the First Difference of the Signal

N

Length of the Signal

G

Number of Guesses Performed

H

Number of Bootstrap replications

K

Number of V matrix bootstraps

model

ts.model supplied to gmwm

model.hat

A new value of ts.model object supplied to gmwm

starting

Indicates whether the procedure used the initial guessing approach

seed

Randomization seed used to generate the guessing values

freq

Frequency of data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# AR
set.seed(1336)
n = 200
data = gen_gts(n, AR1(phi = .99, sigma2 = 0.01) + WN(sigma2 = 1))

# Models can contain specific parameters e.g.
adv.model = gmwm(AR1(phi = .99, sigma2 = 0.01) + WN(sigma2 = 0.01),
                            data)

# Or we can guess the parameters:
guided.model = gmwm(AR1() + WN(), data) 

# Want to try different models? 
guided.ar1 = gmwm(AR1(), data)

# Faster:
guided.ar1.wn.prev = update(guided.ar1, AR1()+WN())

# OR 

# Create new GMWM object. 
# Note this is SLOWER since the Covariance Matrix is recalculated.
guided.ar1.wn.new = gmwm(AR1()+WN(), data)
 
# ARMA case
set.seed(1336)
data = gen_gts(n, ARMA(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488),
              sigma2 = 0.1796))
#guided.arma = gmwm(ARMA(2,2), data, model.type="ssm")
adv.arma = gmwm(ARMA(ar=c(0.8897, -0.4858), ma = c(-0.2279, 0.2488), sigma2=0.1796),
                data, model.type="ssm")

SMAC-Group/gmwm documentation built on Sept. 11, 2021, 10:06 a.m.