| Type: | Package |
| Title: | Time Series Analysis Tools |
| Version: | 0.2.3 |
| LazyData: | true |
| Maintainer: | Stéphane Guerrier <stef.guerrier@gmail.com> |
| Description: | A system contains easy-to-use tools as a support for time series analysis courses. In particular, it incorporates a technique called Generalized Method of Wavelet Moments (GMWM) as well as its robust implementation for fast and robust parameter estimation of time series models which is described, for example, in Guerrier et al. (2013) <doi:10.1080/01621459.2013.799920>. More details can also be found in the paper linked to via the URL below. |
| Depends: | R (≥ 3.6.0) |
| License: | AGPL-3 | file LICENSE |
| Imports: | Rcpp, stats, utils, scales, grDevices, graphics, broom, dplyr,magrittr, methods, purrr, tidyr, robcor |
| LinkingTo: | Rcpp, RcppArmadillo |
| RoxygenNote: | 7.3.3 |
| Encoding: | UTF-8 |
| Suggests: | knitr, rmarkdown |
| VignetteBuilder: | knitr |
| URL: | https://github.com/SMAC-Group/simts,https://arxiv.org/pdf/1607.04543.pdf |
| BugReports: | https://github.com/SMAC-Group/simts/issues |
| NeedsCompilation: | yes |
| Packaged: | 2025-10-08 13:03:30 UTC; lionel |
| Author: | Stéphane Guerrier [aut, cre, cph], James Balamuta [aut, cph], Roberto Molinari [aut, cph], Justin Lee [aut], Lionel Voirol [aut], Yuming Zhang [aut], Wenchao Yang [ctb], Nathanael Claussen [ctb], Yunxiang Zhang [ctb], Christian Gunning [cph], Romain Francois [cph], Ross Ihaka [cph], R Core Team [cph] |
| Repository: | CRAN |
| Date/Publication: | 2025-10-08 14:40:03 UTC |
simts: Time Series Analysis Tools
Description

A system contains easy-to-use tools as a support for time series analysis courses. In particular, it incorporates a technique called Generalized Method of Wavelet Moments (GMWM) as well as its robust implementation for fast and robust parameter estimation of time series models which is described, for example, in Guerrier et al. (2013)doi: 10.1080/01621459.2013.799920. More details can also be found in the paper linked to via the URL below.

A system contains easy-to-use tools as a support for time series analysis courses. In particular, it incorporates a technique called Generalized Method of Wavelet Moments (GMWM) as well as its robust implementation for fast and robust parameter estimation of time series models which is described, for example, in Guerrier et al. (2013)doi: 10.1080/01621459.2013.799920. More details can also be found in the paper linked to via the URL below.
Details
The data sets in this package may change at a moments notice.
Author(s)
Maintainer: Stéphane Guerrierstef.guerrier@gmail.com [copyright holder]
Authors:
James Balamuta [copyright holder]
Roberto Molinari [copyright holder]
Justin Lee
Lionel Voirol
Yuming Zhang
Other contributors:
Wenchao Yang [contributor]
Nathanael Claussen [contributor]
Yunxiang Zhang [contributor]
Christian Gunning [copyright holder]
Romain Francois [copyright holder]
Ross Ihaka [copyright holder]
R Core Team [copyright holder]
James Balamutabalamut2@illinois.edu,Stephane Guerrierstef.guerrier@gmail.com,Roberto Molinariroberto.molinari@hotmail.it,Wenchao Yangwyang40@illinois.eduJustin Leemunsheet93@gmail.comYuming Zhangyuming.zhang@unige.ch
See Also
Useful links:
Report bugs athttps://github.com/SMAC-Group/simts/issues
Useful links:
Report bugs athttps://github.com/SMAC-Group/simts/issues
Multiple a ts.model by constant
Description
Sets up the necessary backend for creating multiple model objects.
Usage
## S3 method for class 'ts.model'x * yArguments
x | A |
y | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
y desc replicated x times
- theta
y theta replicated x times
- plength
Number of Parameters
- desc
y desc replicated x times
- obj.desc
Depth of Parameters e.g. list(c(1,1),c(1,1))
- starting
Guess Starting values? TRUE or FALSE (e.g. specified value)
Author(s)
James Balamuta and Stephane Guerrier
Examples
4*DR()+2*WN()DR()*4 + WN()*2AR1(phi=.3,sigma=.2)*3Add ts.model objects together
Description
Sets up the necessary backend for combining ts.model objects.
Usage
## S3 method for class 'ts.model'x + yArguments
x | A |
y | A |
Value
An S3 object with called ts.model with the following structure:
process.desc | combined x, y desc |
theta | combined x, y theta |
plength | Number of Parameters |
desc | Add process to queue e.g. c("AR1","WN") |
obj.desc | Depth of Parameters e.g. list(1, c(1,1), c(length(ar),length(ma),1) ) |
starting | Guess Starting values? TRUE or FALSE (e.g. specified value) |
Author(s)
James Balamuta
Examples
DR()+WN()AR1(phi=.3,sigma=.2)Auto-Covariance and Correlation Functions
Description
The acf function computes the estimatedautocovariance or autocorrelation for both univariate and multivariate cases.
Usage
.acf(x, lagmax = 0L, cor = TRUE, demean = TRUE)Arguments
x | A |
lagmax | A |
cor | A |
demean | A |
Akaike's Information Criterion
Description
This function calculates AIC, BIC or HQ for a fitsimts object. This function currentlyonly supports models estimated by the MLE.
Usage
## S3 method for class 'fitsimts'AIC(object, k = 2, ...)Arguments
object | A fitsimts object. |
k | The penalty per parameter to be used; the default k = 2 is the classical AIC. |
... | Optionally more fitted model objects. |
Value
AIC, BIC or HQ
Author(s)
Stéphane Guerrier
Examples
set.seed(1)n = 300Xt = gen_gts(n, AR(phi = c(0, 0, 0.8), sigma2 = 1))mod = estimate(AR(3), Xt)# AICAIC(mod)# BICAIC(mod, k = log(n))# HQAIC(mod, k = 2*log(log(n)))Create an Autoregressive P [AR(P)] Process
Description
Sets up the necessary backend for the AR(P) process.
Usage
AR(phi = NULL, sigma2 = 1)Arguments
phi | A |
sigma2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "AR-1","AR-2", ..., "AR-P", "SIGMA2"
- theta
\phi_1,\phi_2, ...,\phi_p,\sigma^2- plength
Number of Parameters
- desc
"AR"
String containing simplified model
- obj.desc
Depth of Parameters e.g. list(p,1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
X_t = \sum_{j = 1}^p \phi_j X_{t-1} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
AR(1) # Slower version of AR1()AR(phi=.32, sigma=1.3) # Slower version of AR1()AR(2) # Equivalent to ARMA(2,0).Definition of an Autoregressive Process of Order 1
Description
Definition of an Autoregressive Process of Order 1
Usage
AR1(phi = NULL, sigma2 = 1)Arguments
phi | A |
sigma2 | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "AR1","SIGMA2"
- theta
Parameter vector including
\phi,\sigma^2- plength
Number of parameters
String containing simplified model
- desc
"AR1"
- obj.desc
Depth of Parameters e.g. list(1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following AR(1) model:
X_t = \phi X_{t-1} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
AR1()AR1(phi=.32, sigma2 = 1.3)Create an Autoregressive Integrated Moving Average (ARIMA) Process
Description
Sets up the necessary backend for the ARIMA process.
Usage
ARIMA(ar = 1, i = 0, ma = 1, sigma2 = 1)Arguments
ar | A |
i | An |
ma | A |
sigma2 | A |
Details
A variance is required since the model generation statements utilize randomization functions expecting a variance instead of a standard deviation like R.
Value
An S3 object with called ts.model with the following structure:
- process.desc
AR*p,MA*q- theta
\sigma- plength
Number of parameters
String containing simplified model
- obj.desc
y desc replicated x times
- obj
Depth of parameters e.g. list(c(length(ar),length(ma),1) )
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
\Delta^i X_t = \sum_{j = 1}^p \phi_j \Delta^i X_{t-j} + \sum_{j = 1}^q \theta_j \varepsilon_{t-j} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
# Create an ARMA(1,2) processARIMA(ar=1,2)# Creates an ARMA(3,2) process with predefined coefficients.ARIMA(ar=c(0.23,.43, .59), ma=c(0.4,.3))# Creates an ARMA(3,2) process with predefined coefficients and standard deviationARIMA(ar=c(0.23,.43, .59), ma=c(0.4,.3), sigma2 = 1.5)Create an Autoregressive Moving Average (ARMA) Process
Description
Sets up the necessary backend for the ARMA process.
Usage
ARMA(ar = 1, ma = 1, sigma2 = 1)Arguments
ar | A |
ma | A |
sigma2 | A |
Details
A variance is required since the model generation statements utilize randomization functions expecting a variance instead of a standard deviation like R.
Value
An S3 object with called ts.model with the following structure:
- process.desc
AR*p,MA*q- theta
\sigma- plength
Number of Parameters
String containing simplified model
- obj.desc
y desc replicated x times
- obj
Depth of Parameters e.g. list(c(length(ar),length(ma),1) )
- starting
Guess Starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
X_t = \sum_{j = 1}^p \phi_j X_{t-j} + \sum_{j = 1}^q \theta_j \varepsilon_{t-j} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
# Create an ARMA(1,2) processARMA(ar=1,2)# Creates an ARMA(3,2) process with predefined coefficients.ARMA(ar=c(0.23,.43, .59), ma=c(0.4,.3))# Creates an ARMA(3,2) process with predefined coefficients and standard deviationARMA(ar=c(0.23,.43, .59), ma=c(0.4,.3), sigma2 = 1.5)Definition of an ARMA(1,1)
Description
Definition of an ARMA(1,1)
Usage
ARMA11(phi = NULL, theta = NULL, sigma2 = 1)Arguments
phi | A |
theta | A |
sigma2 | A |
Details
A variance is required since the model generation statements utilize randomization functions expecting a variance instead of a standard deviation like R.
Value
An S3 object with called ts.model with the following structure:
- process.desc
AR1,MA1,SIGMA2- theta
\phi,\theta,\sigma^2- plength
Number of Parameters: 3
String containing simplified model
- obj.desc
Depth of Parameters e.g. list(c(1,1,1))
- starting
Guess Starting values?
TRUEorFALSE(e.g. specified value)
Note
We consider the following model:
X_t = \phi X_{t-1} + \theta_1 \varepsilon_{t-1} + \varepsilon_t,
where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
# Creates an ARMA(1,1) process with predefined coefficients.ARMA11(phi = .23, theta = .1, sigma2 = 1)# Creates an ARMA(1,1) process with values to be guessed on callibration.ARMA11()Compute Theoretical ACF for an ARMA Process
Description
Compute the theoretical autocorrelation function for an ARMA process.
Usage
ARMAacf_cpp(ar,ma,lag_max)Arguments
ar | A |
ma | A |
lag_max | A |
Details
This is an implementaiton of the ARMAacf function in R. It is approximately 40x times faster. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.
Value
x Amatrix listing values from 1...nx in one column and 1...1, 2...2,....,n...n, in the other
Author(s)
JJB
Converting an ARMA Process to an Infinite MA Process
Description
Takes an ARMA function and converts it to an infinite MA process.
Usage
ARMAtoMA_cpp(ar, ma, lag_max)Arguments
ar | A |
ma | A |
lag_max | A |
Details
This function is a port of the base stats package's ARMAtoMA. There is no significant speed difference between the two.
Value
Acolumn vector containing coefficients
Author(s)
R Core Team and JJB
B Matrix
Description
B Matrix
Usage
B_matrix(A, at_omega)Arguments
A | A |
at_omega | A |
Value
Amat
Create an Drift (DR) Process
Description
Sets up the necessary backend for the DR process.
Usage
DR(omega = NULL)Arguments
omega | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "DR"
- theta
slope
String containing simplified model
- plength
Number of parameters
- obj.desc
y desc replicated x times
- obj
Depth of parameters e.g. list(1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
Y_t = \omega t
Author(s)
James Balamuta
Examples
DR()DR(omega=3.4)Analytic D matrix of Processes
Description
This function computes each process to WV (haar) in a given model.
Usage
D_matrix(theta, desc, objdesc, tau, omegadiff)Arguments
theta | A |
desc | A |
objdesc | A |
tau | A |
omegadiff | A |
Details
Function returns the matrix effectively known as "D"
Value
Amatrix with the process derivatives going down the column
Author(s)
James Joseph Balamuta (JJB)
Definition of a Fractional Gaussian Noise (FGN) Process
Description
Definition of a Fractional Gaussian Noise (FGN) Process
Usage
FGN(sigma2 = 1, H = 0.9999)Arguments
sigma2 | A |
H | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "SIGMA2","H"
- theta
Parameter vector including
\sigma^2,H- plength
Number of parameters
String containing simplified model
- desc
"FGN"
- obj.desc
Depth of Parameters e.g. list(1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Author(s)
Lionel Voirol, Davide Cucci
Examples
FGN()FGN(sigma2 = 1, H = 0.9999)Create a Gauss-Markov (GM) Process
Description
Sets up the necessary backend for the GM process.
Usage
GM(beta = NULL, sigma2_gm = 1)Arguments
beta | A |
sigma2_gm | A |
Details
When supplying values for\beta and\sigma ^2_{gm},these parameters should be of a GM process and NOT of an AR1. That is,do not supply AR1 parameters such as\phi,\sigma^2.
Internally, GM parameters are converted to AR1 using the 'freq' supplied when creating data objects (gts)or specifying a 'freq' parameter in simts or simts.imu.
The 'freq' of a data object takes precedence over the 'freq' set when modeling.
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "BETA","SIGMA2"
- theta
\beta,\sigma ^2_{gm}- plength
Number of parameters
String containing simplified model
- desc
"GM"
- obj.desc
Depth of parameters e.g. list(1,1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
X_t = e^{(-\beta)} X_{t-1} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2(1-e^{2\beta}).
Author(s)
James Balamuta
Examples
GM()GM(beta=.32, sigma2_gm=1.3)Definition of a Mean deterministic vector returned by the matrix by vector product of matrixX and vector\beta
Description
Definition of a Mean deterministic vector returned by the matrix by vector product of matrixX and vector\beta
Usage
M(X, beta)Arguments
X | A |
beta | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "X","BETA"
- theta
Matrix X, vector beta
- plength
Number of parameters
String containing simplified model
- desc
"M"
- obj.desc
Depth of Parameters e.g. list(1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Author(s)
Lionel Voirol, Davide Cucci
Examples
X = matrix(rnorm(15*5), nrow = 15, ncol = 5)beta=seq(5)M(X = X, beta = beta)Create an Moving Average Q [MA(Q)] Process
Description
Sets up the necessary backend for the MA(Q) process.
Usage
MA(theta = NULL, sigma2 = 1)Arguments
theta | A |
sigma2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "MA-1","MA-2", ..., "MA-Q", "SIGMA2"
- theta
\theta_1,\theta_2, ...,\theta_q,\sigma^2- plength
Number of parameters
- desc
"MA"
String containing simplified model
- obj.desc
Depth of parameters e.g. list(q,1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
X_t = \sum_{j = 1}^q \theta_j \varepsilon_{t-1} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
MA(1) # One thetaMA(2) # Two thetas!MA(theta=.32, sigma=1.3) # 1 theta with a specific value.MA(theta=c(.3,.5), sigma=.3) # 2 thetas with specific values.Definition of an Moving Average Process of Order 1
Description
Definition of an Moving Average Process of Order 1
Usage
MA1(theta = NULL, sigma2 = 1)Arguments
theta | A |
sigma2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "MA1","SIGMA2"
- theta
\theta,\sigma^2- plength
Number of parameters
String containing simplified model
- desc
"MA1"
- obj.desc
Depth of parameters e.g. list(1,1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
X_t = \theta \varepsilon_{t-1} + \varepsilon_t
, where\varepsilon_t is iid from a zero mean normal distribution with variance\sigma^2.
Author(s)
James Balamuta
Examples
MA1()MA1(theta = .32, sigma2 = 1.3)Median Absolute Prediction Error
Description
This function calculates Median Absolute Prediction Error (MAPE), which assesses the prediction performance with respect to point forecasts of a given model. It is calculated based on one-step ahead prediction and reforecasting.
Usage
MAPE(model, Xt, start = 0.8, plot = TRUE)Arguments
model | A time series model. |
Xt | A |
start | A |
plot | A |
Value
The MAPE calculated based on one-step ahead prediction and reforecastingis returned along with its standard deviation.
Author(s)
Stéphane Guerrier and Yuming Zhang
Definition of a Matérn Process
Description
Definition of a Matérn Process
Usage
MAT(sigma2 = 1, lambda = 0.35, alpha = 0.9)Arguments
sigma2 | A |
lambda | A |
alpha | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "SIGMA2","LAMBDA""ALPHA"
- theta
Parameter vector including
\sigma^2,\lambda,\alpha- plength
Number of parameters
String containing simplified model
- desc
"MAT"
- obj.desc
Depth of Parameters e.g. list(1,1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Author(s)
Lionel Voirol, Davide Cucci
Examples
MAT()MAT(sigma2 = 1, lambda = 0.35, alpha = 0.9)Ma function.
Description
Ma function.
Usage
Ma_cpp(x, alpha)Arguments
x | A |
alpha | A |
Ma vectorized function.
Description
Ma vectorized function.
Usage
Ma_cpp_vec(x, alpha)Arguments
x | A |
Absolute Value or Modulus of a Complex Number.
Description
Computes the value of the Modulus.
Usage
Mod_cpp(x)Arguments
x | A |
Details
Consider a complex number defined as:z = x + i y with realx andy,The modulus is defined as:r = Mod(z) = \sqrt{(x^2 + y^2)}
Value
Avec containing the modulus for each element.
Definition of a Power Law Process
Description
Definition of a Power Law Process
Usage
PLP(sigma2 = 1, d = 0.4)Arguments
sigma2 | A |
d | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "SIGMA2","d"
- theta
Parameter vector including
\sigma^2,d- plength
Number of parameters
String containing simplified model
- desc
"PLP"
- obj.desc
Depth of Parameters e.g. list(1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Author(s)
Lionel Voirol, Davide Cucci
Examples
PLP()PLP(sigma2 = 1, d = 0.4)Create an Quantisation Noise (QN) Process
Description
Sets up the necessary backend for the QN process.
Usage
QN(q2 = NULL)Arguments
q2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "QN"
- theta
Q^2- plength
Number of parameters
String containing simplified model
- desc
y desc replicated x times
- obj.desc
Depth of parameters e.g. list(1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Author(s)
James Balamuta
Examples
QN()QN(q2=3.4)Create an Random Walk (RW) Process
Description
Sets up the necessary backend for the RW process.
Usage
RW(gamma2 = NULL)Arguments
gamma2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "RW"
- theta
\sigma- plength
Number of parameters
String containing simplified model
- desc
y desc replicated x times
- obj.desc
Depth of parameters e.g. list(1)
- starting
Guess starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following model:
Y_t = \sum\nolimits_{t=0}^{T} \gamma_0*Z_t
whereZ_t is iid and follows a standard normal distribution.
Author(s)
James Balamuta
Examples
RW()RW(gamma2=3.4)Function to Compute Direction Random Walk Moves
Description
The RW2dimension function computes direction random walk moves.
Usage
RW2dimension(steps = 100, probs = c(0.25, 0.5, 0.75))Arguments
steps | An |
probs | A |
Author(s)
Stéphane Guerrier
Examples
RW2dimension(steps = 50, probs = c(0.2, 0.5, 0.6))Hook into R's ARIMA function
Description
Uses R's ARIMA function to obtain CSS values for starting condition
Usage
Rcpp_ARIMA(data, params)Arguments
data | A |
params | A |
Value
Avec containing the CSS of the ARMA parameters.
Create a Seasonal Autoregressive Integrated Moving Average (SARIMA) Process
Description
Sets up the necessary backend for the SARIMA process.
Usage
SARIMA(ar = 1, i = 0, ma = 1, sar = 1, si = 0, sma = 1, s = 12, sigma2 = 1)Arguments
ar | A |
i | An |
ma | A |
sar | A |
si | An |
sma | A |
s | An |
sigma2 | A |
Details
A variance is required since the model generation statements utilize randomization functions expecting a variance instead of a standard deviation unlike R.
Value
An S3 object with called ts.model with the following structure:
- process.desc
AR*p,MA*q,SAR*P,SMA*Q- theta
\sigma- plength
Number of parameters
- desc
Type of model
- desc.simple
Type of model (after simplification)
String containing simplified model
- obj.desc
y desc replicated x times
- obj
Depth of Parameters e.g. list(c(length(ar), length(ma), length(sar), length(sma), 1, i, si) )
- starting
Guess Starting values? TRUE or FALSE (e.g. specified value)
Author(s)
James Balamuta
Examples
# Create an SARIMA(1,1,2)x(1,0,1) processSARIMA(ar = 1, i = 1, ma = 2, sar = 1, si = 0, sma =1)# Creates an SARMA(1,0,1)x(1,1,1) process with predefined coefficients.SARIMA(ar=0.23, i = 0, ma=0.4, sar = .3, sma = .3)Create a Seasonal Autoregressive Moving Average (SARMA) Process
Description
Sets up the necessary backend for the SARMA process.
Usage
SARMA(ar = 1, ma = 1, sar = 1, sma = 1, s = 12, sigma2 = 1)Arguments
ar | A |
ma | A |
sar | A |
sma | A |
s | A |
sigma2 | A |
Details
A variance is required since the model generation statements utilize randomization functions expecting a variance instead of a standard deviation unlike R.
Value
An S3 object with called ts.model with the following structure:
- process.desc
AR*p,MA*q,SAR*P,SMA*Q- theta
\sigma- plength
Number of Parameters
String containing simplified model
- obj.desc
y desc replicated x times
- obj
Depth of Parameters e.g. list(c(length(ar), length(ma), length(sar), length(sma), 1) )
- starting
Guess Starting values? TRUE or FALSE (e.g. specified value)
Author(s)
James Balamuta
Examples
# Create an SARMA(1,2)x(1,1) processSARMA(ar = 1, ma = 2,sar = 1, sma =1)# Creates an SARMA(1,1)x(1,1) process with predefined coefficients.SARMA(ar=0.23, ma=0.4, sar = .3, sma = .3)Definition of a Sinusoidal (SIN) Process
Description
Definition of a Sinusoidal (SIN) Process
Usage
SIN(alpha2 = 9e-04, beta = 0.06, U = NULL)Arguments
alpha2 | A |
beta | A |
U | A |
Value
An S3 object containing the specified ts.model with the following structure:
- process.desc
Used in summary: "ALPHA2","BETA"
- theta
Parameter vector including
\alpha^2,\beta- plength
Number of parameters
String containing simplified model
- desc
"SIN"
- obj.desc
Depth of Parameters e.g. list(1,1)
- starting
Find starting values? TRUE or FALSE (e.g. specified value)
Note
We consider the following sinusoidal process :
X_t = \alpha \sin(\beta t + U)
, whereU \sim \mathcal{U}(0, 2\pi)and\beta \in (0, \frac{\pi}{2})
Author(s)
Lionel Voirol
Examples
SIN()SIN(alpha2 = .5, beta = .05)Create an White Noise (WN) Process
Description
Sets up the necessary backend for the WN process.
Usage
WN(sigma2 = NULL)Arguments
sigma2 | A |
Value
An S3 object with called ts.model with the following structure:
- process.desc
Used in summary: "WN"
- theta
\sigma- plength
Number of Parameters
String containing simplified model
- desc
y desc replicated x times
- obj.desc
Depth of Parameters e.g. list(1)
- starting
Guess Starting values? TRUE or FALSE (e.g. specified value)
Note
In this process,Y_t is iid from a zero mean normal distribution with variance\sigma^2
Author(s)
James Balamuta
Examples
WN()WN(sigma2=3.4)Subset an IMU Object
Description
Enables the IMU object to be subsettable. That is, you can load all the data in and then select certain properties.
Usage
## S3 method for class 'imu'x[i, j, drop = FALSE]Arguments
x | A |
i | A |
j | A |
drop | A |
Details
When using the subset operator, note that all the Gyroscopes are placed at the front of object and, then, the Accelerometers are placed.
Value
Animu object class.
Examples
## Not run: if(!require("imudata")){install_imudata()library("imudata")}data(imu6)# Create an IMU Object that is full. ex = imu(imu6, gyros = 1:3, accels = 4:6, axis = c('X', 'Y', 'Z', 'X', 'Y', 'Z'), freq = 100)# Create an IMU object that has only gyros. ex.gyro = ex[,1:3]ex.gyro2 = ex[,c("Gyro. X","Gyro. Y","Gyro. Z")]# Create an IMU object that has only accels. ex.accel = ex[,4:6]ex.accel2 = ex[,c("Accel. X","Accel. Y","Accel. Z")]# Create an IMU object with both gyros and accels on axis X and Yex.b = ex[,c(1,2,4,5)]ex.b2 = ex[,c("Gyro. X","Gyro. Y","Accel. X","Accel. Y")]## End(Not run)Helper Function for ARMA to WV Approximation
Description
Indicates where the minimum ARMAacf value is and returns that as an index.
Usage
acf_sum(ar, ma, last_tau, alpha = 0.99)Arguments
ar | A |
ma | A |
last_tau | An |
alpha | A |
Value
Avec containing the wavelet variance of the ARMA process.
Bootstrap for Everything!
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters, obtain the wavelet variance, and then V.
Usage
all_bootstrapper( theta, desc, objdesc, scales, model_type, N, robust, eff, alpha, H)Arguments
theta | A |
desc | A |
objdesc | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Randomly guess starting parameters for AR1
Description
Sets starting parameters for each of the given parameters.
Usage
ar1_draw(draw_id, last_phi, sigma2_total, model_type)Arguments
draw_id | An |
last_phi | A |
sigma2_total | A |
model_type | A |
Value
Avec containing smart parameter starting guesses to be iterated over.
Transform AR1 to GM
Description
Takes AR1 values and transforms them to GM
Usage
ar1_to_gm(theta, freq)Arguments
theta | A |
freq | A |
Details
The function takes a vector of AR1 values\phi and\sigma ^2and transforms them to GM values\beta and\sigma ^2_{gm}using the formulas:\beta = - \frac{{\ln \left( \phi \right)}}{{\Delta t}}\sigma _{gm}^2 = \frac{{{\sigma ^2}}}{{1 - {\phi ^2}}}
Value
Avec containing GM values.
Author(s)
James Balamuta
AR(1) process to WV
Description
This function computes the Haar WV of an AR(1) process
Usage
ar1_to_wv(phi, sigma2, tau)Arguments
phi | A |
sigma2 | A |
tau | A |
Details
This function is significantly faster than its generalized counter partarma_to_wv.
Value
Avec containing the wavelet variance of the AR(1) process.
Process Haar Wavelet Variance Formula
The Autoregressive Order1 (AR(1)) process has a Haar Wavelet Variance given by:
\frac{{2{\sigma ^2}\left( {4{\phi ^{\frac{{{\tau _j}}}{2} + 1}} - {\phi ^{{\tau _j} + 1}} - \frac{1}{2}{\phi ^2}{\tau _j} + \frac{{{\tau _j}}}{2} - 3\phi } \right)}}{{{{\left( {1 - \phi } \right)}^2}\left( {1 - {\phi ^2}} \right)\tau _j^2}}
ARMA(1,1) to WV
Description
This function computes the WV (haar) of an Autoregressive Order 1 - Moving Average Order 1 (ARMA(1,1)) process.
Usage
arma11_to_wv(phi, theta, sigma2, tau)Arguments
phi | A |
theta | A |
sigma2 | A |
tau | A |
Details
This function is significantly faster than its generalized counter partarma_to_wv
Value
Avec containing the wavelet variance of the ARMA(1,1) process.
Process Haar Wavelet Variance Formula
The Autoregressive Order1 and Moving Average Order1 (ARMA(1,1)) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = - \frac{{2{\sigma ^2}\left( { - \frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} - (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right)}}{{{{(\phi - 1)}^3}(\phi + 1)\tau _j^2}}
ARMA Adapter to ARMA to WV Process function
Description
Molds the data so that it works with the arma_to_wv function.
Usage
arma_adapter(theta, p, q, tau)Arguments
theta | A |
p | A |
q | A |
tau | A |
Details
The data conversion is more or less a rearrangement of values without using the obj desc.
Value
Avec containing the ARMA to WV results
Author(s)
James Joseph Balamuta (JJB)
Randomly guess starting parameters for ARMA
Description
Sets starting parameters for each of the given parameters.
Usage
arma_draws(p, q, sigma2_total)Arguments
p | An |
q | An |
sigma2_total | A |
Value
Avec containing smart parameter starting guesses to be iterated over.
ARMA process to WV
Description
This function computes the Haar Wavelet Variance of an ARMA process
Usage
arma_to_wv(ar, ma, sigma2, tau)Arguments
ar | A |
ma | A |
sigma2 | A |
tau | A |
Details
The function is a generic implementation that requires a stationary theoretical autocorrelation function (ACF)and the ability to transform an ARMA(p,q) process into an MA(\infty) (e.g. infinite MA process).
Value
Avec containing the wavelet variance of the ARMA process.
Process Haar Wavelet Variance Formula
The Autoregressive Orderp and Moving Average Orderq (ARMA(p,q)) process has a Haar Wavelet Variance given by:
\frac{{{\tau _j}\left[ {1 - \rho \left( {\frac{{{\tau _j}}}{2}} \right)} \right] + 2\sum\limits_{i = 1}^{\frac{{{\tau _j}}}{2} - 1} {i\left[ {2\rho \left( {\frac{{{\tau _j}}}{2} - i} \right) - \rho \left( i \right) - \rho \left( {{\tau _j} - i} \right)} \right]} }}{{\tau _j^2}}\sigma _X^2
where\sigma _X^2 is given by the variance of the ARMA process. Furthermore, this assumes that stationarity has been achieved as it directly
ARMA process to WV Approximation
Description
This function computes the (haar) WV of an ARMA process
Usage
arma_to_wv_app(ar, ma, sigma2, tau, alpha = 0.9999)Arguments
ar | A |
ma | A |
sigma2 | A |
tau | A |
alpha | A |
Details
This function provides an approximation to thearma_to_wv as computation timeswere previously a concern. However, this is no longer the case and, thus, this has been leftin for the curious soul to discover...
Value
Avec containing the wavelet variance of the ARMA process.
Process Haar Wavelet Variance Formula
The Autoregressive Orderp and Moving Average Orderq (ARMA(p,q)) process has a Haar Wavelet Variance given by:
\frac{{{\tau _j}\left[ {1 - \rho \left( {\frac{{{\tau _j}}}{2}} \right)} \right] + 2\sum\limits_{i = 1}^{\frac{{{\tau _j}}}{2} - 1} {i\left[ {2\rho \left( {\frac{{{\tau _j}}}{2} - i} \right) - \rho \left( i \right) - \rho \left( {{\tau _j} - i} \right)} \right]} }}{{\tau _j^2}}\sigma _X^2
where\sigma _X^2 is given by the variance of the ARMA process. Furthermore, this assumes that stationarity has been achieved as it directly
Quarterly Increase in Stocks Non-Farm Total, Australia
Description
A dataset containing the quarterly increase in stocks non-farm total in Australia, with frequency 4 starting from September 1959 to March 1991 with a total of 127 observations.
Usage
australiaFormat
A data frame with 127 rows and 2 variables:
- Quarter
year and quarter
- Increase
quarterly increase in stocks non-farm total
Source
Time Series Data Library (citing: Australian Bureau of Statistics) datamarket
Empirical ACF and PACF
Description
This function can estimate either the autocovariance / autocorrelation for univariate time series,or the partial autocovariance / autocorrelation for univariate time series.
Usage
auto_corr( x, lag.max = NULL, pacf = FALSE, type = "correlation", demean = TRUE, robust = FALSE)Arguments
x | A |
lag.max | An |
pacf | A |
type | A |
demean | A |
robust | A |
Details
lagmax default is10*log10(N/m) whereN is the number ofobservations andm is the number of time series being compared. Iflagmax supplied is greater than the number of observations N, then oneless than the total will be taken (i.e. N - 1).
Value
Anarray of dimensionsN \times 1 \times 1.
Author(s)
Yuming Zhang
Examples
m = auto_corr(datasets::AirPassengers)m = auto_corr(datasets::AirPassengers, pacf = TRUE)Find the auto imu result
Description
Provides the core material to create an S3 object for auto.imu
Usage
auto_imu_cpp( data, combs, full_model, alpha, compute_v, model_type, K, H, G, robust, eff, bs_optimism, seed)Arguments
data | A |
full_model | A |
alpha | A |
compute_v | A |
model_type | A |
K | A |
H | A |
G | A |
robust | A |
eff | A |
bs_optimism | A |
seed | A |
Value
Afield<field<field<mat>>> that contains the model score matrix and the best GMWM model object.
Computes the MO/DWT wavelet variance for multiple processes
Description
Calculates the MO/DWT wavelet variance
Usage
batch_modwt_wvar_cpp( signal, nlevels, robust, eff, alpha, ci_type, strWavelet, decomp)Arguments
signal | A |
robust | A |
eff | A |
alpha | A |
ci_type | A |
strWavelet | A |
decomp | A |
Details
This function processes the decomposition of multiple signals quickly
Value
Afield<mat> with the structure:
"variance" | Wavelet Variance |
"low" | Lower CI |
"high" | Upper CI |
Select the Best Model
Description
This function retrieves the best model from a selection procedure.
Usage
best_model(x, ic = "aic")Arguments
x | An object of class |
ic | A |
Examples
set.seed(18)xt = gen_arima(N=100, ar=0.3, d=1, ma=0.3)x = select_arima(xt, d=1L)best_model(x, ic = "aic")set.seed(19)xt = gen_ma1(100, 0.3, 1)x = select_ma(xt, q.min=2L, q.max=5L)best_model(x, ic = "bic")set.seed(20)xt = gen_arma(100, c(.3,.5), c(.1), 1, 0) x = select_arma(xt, p.min = 1L, p.max = 4L, q.min = 1L, q.max = 3L)best_model(x, ic = "hq")bl14 filter construction
Description
Creates the bl14 filter
Usage
bl14_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
bl20 filter construction
Description
Creates the bl20 filter
Usage
bl20_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Generate the Confidence Interval for GOF Bootstrapped
Description
yaya
Usage
boot_pval_gof(obj, obj_boot, B = 1000L, alpha = 0.05)Arguments
obj | A |
obj_boot | A |
B | An |
alpha | A |
Value
Avec that has the alpha/2.0 quantile and then the 1-alpha/2.0 quantile.
Compute the Bootstrapped GoF Test
Description
Handles the bootstrap computation and the bootstrapped p-value.
Usage
bootstrap_gof_test(obj_value, bs_obj_values, alpha, bs_gof_p_ci)Arguments
obj_value | A |
bs_obj_values | A |
alpha | A |
bs_gof_p_ci | A |
Value
Avec that has
Test Statistic
Low CI
Upper CI - BS
Removal of Boundary Wavelet Coefficients
Description
Removes the first n wavelet coefficients.
Usage
brick_wall(x, wave_filter, method)Arguments
x | A |
wave_filter | A |
method | A |
Details
The vectors are truncated by removing the first n wavelet coefficients. These vectors are then stored into the field that is returned.Note: As a result, there are no NA's introduced and hence the na.omit is not needed.
Value
Afield<vec> with boundary modwt or dwt taken care of.
Build List of Unique Models
Description
Creates a set containing unique strings.
Usage
build_model_set(combs, x)Arguments
combs | A |
x | A |
Value
Aset<string> that contains the list of unique models.
Calculate the Psi matrix
Description
Computes the Psi matrix using supplied parameters
Usage
calculate_psi_matrix(A, v_hat, omega)Arguments
A | first derivative matrix |
v_hat | bootstrapped V |
omega | original omega matrix |
Value
Amat that has the first column
Time Series Convolution Filters
Description
Applies a convolution filter to a univariate time series.
Usage
cfilter(x, filter, sides, circular)Arguments
x | A |
filter | A |
sides | An |
circular | A |
Details
This is a port of the cfilter function harnessed by the filter function in stats. It is about 5-7 times faster than R's base function. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.
Value
Acolumn vec that contains the results of the filtering process.
Author(s)
R Core Team and JJB
Diagnostics on Fitted Time Series Model
Description
This function can perform (simple) diagnostics on the fitted time series model.It can output 6 diagnostic plots to assess the model, including (1) residuals plot,(2) histogram of distribution of standardized residuals, (3) Normal Q-Q plot of residuals,(4) ACF plot, (5) PACF plot, (6) Box test results.
Usage
check(model = NULL, resids = NULL, simple = FALSE)Arguments
model | A |
resids | A |
simple | A |
Author(s)
Stéphane Guerrier and Yuming Zhang
Examples
Xt = gen_gts(300, AR(phi = c(0, 0, 0.8), sigma2 = 1))model = estimate(AR(3), Xt)check(model)check(resids = rnorm(100))Xt = gen_gts(1000, SARIMA(ar = c(0.5, -0.25), i = 0, ma = 0.5, sar = -0.8, si = 1, sma = 0.25, s = 24, sigma2 = 1))model = estimate(SARIMA(ar = 2, i = 0, ma = 1, sar = 1, si = 1, sma = 1, s = 24), Xt, method = "rgmwm")check(model)check(model, simple=TRUE)Generate eta3 confidence interval
Description
Computes the eta3 CI
Usage
ci_eta3(y, dims, alpha_ov_2)Arguments
y | A |
dims | A |
alpha_ov_2 | A |
Value
Amatrix with the structure:
Column 1 | Wavelet Variance |
Column 2 | Chi-squared Lower Bounds |
Column 3 | Chi-squared Upper Bounds |
Generate eta3 robust confidence interval
Description
Computes the eta3 robust CI
Usage
ci_eta3_robust(wv_robust, wv_ci_class, alpha_ov_2, eff)Arguments
wv_robust | A |
wv_ci_class | A |
alpha_ov_2 | A |
eff | A |
Details
Within this function we are scaling the classical
Value
Amatrix with the structure:
Column 1 | Robust Wavelet Variance |
Column 2 | Chi-squared Lower Bounds |
Column 3 | Chi-squared Upper Bounds |
Generate a Confidence intervval for a Univariate Time Series
Description
Computes an estimate of the multiscale variance and a chi-squared confidence interval
Usage
ci_wave_variance( signal_modwt_bw, wv, type = "eta3", alpha_ov_2 = 0.025, robust = FALSE, eff = 0.6)Arguments
signal_modwt_bw | A |
wv | A |
type | A |
alpha_ov_2 | A |
robust | A |
eff | A |
Details
This function can be expanded to allow for other confidence interval calculations.
Value
Amatrix with the structure:
Column 1 | Wavelet Variance |
Column 2 | Chi-squared Lower Bounds |
Column 3 | Chi-squared Upper Bounds |
Optim loses NaN
Description
This function takes numbers that are very small and sets them to the minimal tolerance for C++.Doing this prevents NaN from entering the optim routine.
Usage
code_zero(theta)Arguments
theta | A |
Value
Avec that contains safe theta values.
Combine math expressions
Description
Combine math expressions
Usage
comb(...)Arguments
... | Expressions to combine. |
Value
A combined expression.
Author(s)
Stephane Guerrier
Comparison of Classical and Robust Correlation Analysis Functions
Description
Compare classical and robust ACFof univariate time series.
Usage
compare_acf( x, lag.max = NULL, demean = TRUE, show.ci = TRUE, alpha = 0.05, plot = TRUE, ...)Arguments
x | A |
lag.max | A |
demean | A |
show.ci | A |
alpha | A |
plot | A |
... | Additional parameters. |
Author(s)
Yunxiang Zhang
Examples
# Estimate both the ACF and PACF functionscompare_acf(datasets::AirPassengers)Computes the (MODWT) wavelet covariance matrix
Description
Calculates the (MODWT) wavelet covariance matrix
Usage
compute_cov_cpp( signal_modwt, nb_level, compute_v = "diag", robust = TRUE, eff = 0.6)Arguments
signal_modwt | A |
nb_level | A |
compute_v | A |
robust | A |
eff | A |
Value
Afield<mat> containing the covariance matrix.
GM Conversion
Description
Convert from AR1 to GM and vice-versa
Usage
conv.ar1.to.gm(theta, process.desc, freq)conv.gm.to.ar1(theta, process.desc, freq)Arguments
theta | A |
process.desc | A |
freq | A |
Author(s)
James Balamuta
Correlation Analysis Functions
Description
Correlation Analysis function computes and plots both empirical ACF and PACFof univariate time series.
Usage
corr_analysis( x, lag.max = NULL, type = "correlation", demean = TRUE, show.ci = TRUE, alpha = 0.05, plot = TRUE, ...)Arguments
x | A |
lag.max | A |
type | A |
demean | A |
show.ci | A |
alpha | A |
plot | A |
... | Additional parameters. |
Value
Twoarray objects (ACF and PACF) of dimensionN \times S \times S.
Author(s)
Yunxiang Zhang
Examples
# Estimate both the ACF and PACF functionscorr_analysis(datasets::AirPassengers)Count Models
Description
Count the amount of models that exist.
Usage
count_models(desc)Arguments
desc | A |
Value
Amap<string, int> containing how frequent the model component appears.
Bootstrap for Matrix V
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters, obtain the wavelet variance, and then V.
Usage
cov_bootstrapper(theta, desc, objdesc, N, robust, eff, H, diagonal_matrix)Arguments
theta | A |
desc | A |
objdesc | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Internal IMU Object Construction
Description
Internal quick build for imu object.
Usage
create_imu( data, ngyros, nacces, axis, freq, unit = NULL, name = NULL, stype = NULL)Arguments
data | A |
ngyros | An |
nacces | An |
axis | A |
freq | An |
unit | A |
name | A |
stype | A |
Value
Animu object class.
Author(s)
James Balamuta
Custom legend function
Description
Legend placement function
Usage
custom_legend(x, usr = par("usr"), ...)d16 filter construction
Description
Creates the d16 filter
Usage
d16_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
d4 filter construction
Description
Creates the d4 filter
Usage
d4_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
d6 filter construction
Description
Creates the d6 filter
Usage
d6_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
d8 filter construction
Description
Creates the d8 filter
Usage
d8_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Each Models Process Decomposed to WV
Description
This function computes each process to WV (haar) in a given model.
Usage
decomp_theoretical_wv(theta, desc, objdesc, tau)Arguments
theta | A |
desc | A |
objdesc | A |
tau | A |
Value
Amat containing the wavelet variance of each process in the model
Decomposed WV to Single WV
Description
This function computes the combined processes to WV (haar) in a given model.
Usage
decomp_to_theo_wv(decomp)Arguments
decomp | A |
Value
Avec containing the wavelet variance of the process for the overall model
Analytic second derivative matrix for AR(1) process
Description
Calculates the second derivative for the AR(1) process and places it into a matrix form.The matrix form in this case is for convenience of the calculation.
Usage
deriv_2nd_ar1(phi, sigma2, tau)Arguments
phi | A |
sigma2 | A |
tau | A |
Value
Amatrix with the first column containing thesecond partial derivative with respect to\phi andthe second column contains the second partial derivative with respect to\sigma ^2
Process Haar WV Second Derivative
Taking the second derivative with respect to\phi yields:
\frac{{{\partial ^2}}}{{\partial {\phi ^2}}}\nu _j^2\left( \phi, \sigma ^2 \right) = \frac{2 \sigma ^2 \left(\left(\phi ^2-1\right) \tau _j \left(2 (\phi (7 \phi +4)+1) \phi ^{\frac{\tau _j}{2}-1}-(\phi (7 \phi +4)+1) \phi ^{\tau _j-1}+3 (\phi +1)^2\right)+\left(\phi ^2-1\right)^2 \tau _j^2 \left(\phi ^{\frac{\tau _j}{2}}-1\right) \phi ^{\frac{\tau _j}{2}-1}+4 (3 \phi +1) \left(\phi ^2+\phi +1\right) \left(\phi ^{\tau _j}-4 \phi ^{\frac{\tau _j}{2}}+3\right)\right)}{(\phi -1)^5 (\phi +1)^3 \tau _j^2}
Taking the second derivative with respect to\sigma^2 yields:
\frac{{{\partial ^2}}}{{\partial {\sigma ^4}}}\nu _j^2\left( \sigma ^2 \right) = 0
Taking the derivative with respect to\phi and\sigma ^2 yields:
\frac{{{\partial ^2}}}{{\partial {\phi } \partial {\sigma ^2}}}\nu _j^2\left( \phi, \sigma ^2 \right) = \frac{2 \left(\left(\phi ^2-1\right) \tau _j \left(\phi ^{\tau _j}-2 \phi ^{\frac{\tau _j}{2}}-\phi -1\right)-(\phi (3 \phi +2)+1) \left(\phi ^{\tau _j}-4 \phi ^{\frac{\tau _j}{2}}+3\right)\right)}{(\phi -1)^4 (\phi +1)^2 \tau _j^2}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for ARMA(1,1) process
Description
Obtain the second derivative of the ARMA(1,1) process.
Usage
deriv_2nd_arma11(phi, theta, sigma2, tau)Arguments
phi | A |
theta | A |
sigma2 | A |
tau | A |
Value
Amatrix with:
Thefirst column containing the second partial derivative with respect to
\phi;Thesecond column containing the second partial derivative with respect to
\theta;Thethird column contains the second partial derivative with respect to
\sigma ^2.Thefourth column contains the partial derivative with respect to
\phiand\theta.Thefiveth column contains the partial derivative with respect to
\sigma ^2and\phi.Thesixth column contains the partial derivative with respect to
\sigma ^2and\theta.
Process Haar WV Second Derivative
Taking the second derivative with respect to\phi yields:
\frac{{{\partial ^2}}}{{\partial {\phi ^2}}}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}}}{{{{(\phi - 1)}^5}{{(\phi + 1)}^3}\tau _j^2}}\left( \begin{array}{cc}&{(\phi - 1)^2}\left( {{{(\phi + 1)}^2}\left( {{\theta ^2}\phi + \theta {\phi ^2} + \theta + \phi } \right)\tau _j^2\left( {{\phi ^{\frac{{{\tau _j}}}{2}}} - 1} \right){\phi ^{\frac{{{\tau _j}}}{2} - 2}} + \left( {{\phi ^2} - 1} \right)\left( {{\theta ^2}( - \phi ) + \theta \left( {{\phi ^2} + 4\phi + 1} \right) - \phi } \right){\tau _j}\left( {{\phi ^{\frac{{{\tau _j}}}{2}}} - 2} \right){\phi ^{\frac{{{\tau _j}}}{2} - 2}} - 2{{(\theta - 1)}^2}\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right) \\&- 12{(\phi + 1)^2}\left( { - \frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} - (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right) \\&+ 6(\phi + 1)(\phi - 1)\left( {\frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} + (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) + (\phi + 1)\left( { - (\theta + \phi )(\theta \phi + 1){\tau _j}\left( {{\phi ^{\frac{{{\tau _j}}}{2}}} - 2} \right){\phi ^{\frac{{{\tau _j}}}{2} - 1}} - \theta (\theta + \phi )\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) - (\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) - {{(\theta + 1)}^2}\phi {\tau _j}} \right)} \right) \\ \end{array} \right)
Taking the second derivative with respect to\theta yields:
\frac{{{\partial ^2}}}{{\partial {\theta ^2}}}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}\left( {\left( {{\phi ^2} - 1} \right){\tau _j} + 2\phi \left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right)}}{{{{(\phi - 1)}^3}(\phi + 1)\tau _j^2}}
Taking the second derivative with respect to\sigma ^2 yields:
\frac{{{\partial ^2}}}{{\partial {\sigma ^4}}}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = 0
Taking the derivative with respect to\sigma^2 and\theta yields:
\frac{\partial }{{\partial \theta }}\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{2}{{{{(\phi - 1)}^3}(\phi + 1)\tau _j^2}}\left( {(\theta + 1)\left( {{\phi ^2} - 1} \right){\tau _j} + \left( {2\theta \phi + {\phi ^2} + 1} \right)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right)
Taking the derivative with respect to\sigma^2 and\phi yields:
\frac{\partial }{{\partial \phi }}\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{2}{{{{(\phi - 1)}^4}{{(\phi + 1)}^2}\tau _j^2}}\left( \begin{array}{ll}&- (\phi - 1)(\phi + 1)\left( \begin{array}{ll} &- (\theta + \phi )(\theta \phi + 1){\tau _j}\left( {{\phi ^{\frac{{{\tau _j}}}{2}}} - 2} \right){\phi ^{\frac{{{\tau _j}}}{2} - 1}} \\ &- \theta (\theta + \phi )\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) \\ &- (\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) \\ &- {(\theta + 1)^2}\phi {\tau _j} \\ \end{array} \right) \\&+ (\phi - 1)\left( { - \frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} - (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right) \\&+ 3(\phi + 1)\left( { - \frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} - (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right) \\ \end{array} \right)
Taking the derivative with respect to\phi and\theta yields:
\frac{\partial }{{\partial \theta }}\frac{\partial }{{\partial \phi }}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = - \frac{{2{\sigma ^2}}}{{{{(\phi - 1)}^4}{{(\phi + 1)}^2}\tau _j^2}}\left( \begin{array}{cc}&{\tau _j}\left( \begin{array}{cc} &2(\theta + 1)(\phi - 1){(\phi + 1)^2} \\ &+ 2\left( {{\phi ^2} - 1} \right)\left( {2\theta \phi + {\phi ^2} + 1} \right){\phi ^{\frac{{{\tau _j}}}{2} - 1}} \\ &- \left( {{\phi ^2} - 1} \right)\left( {2\theta \phi + {\phi ^2} + 1} \right){\phi ^{{\tau _j} - 1}} \\ \end{array} \right) \\&+ 2\left( {\theta (\phi (3\phi + 2) + 1) + \phi \left( {{\phi ^2} + \phi + 3} \right) + 1} \right)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) \\ \end{array} \right)
Author(s)
James Joseph Balamuta (JJB)
Analytic second derivative matrix for drift process
Description
To ease a later calculation, we place the result into a matrix structure.
Usage
deriv_2nd_dr(tau)Arguments
tau | A |
Value
Amatrix with the first column containing the second partial derivative with respect to\omega.
Author(s)
James Joseph Balamuta (JJB)
Analytic second derivative for MA(1) process
Description
To ease a later calculation, we place the result into a matrix structure.
Usage
deriv_2nd_ma1(theta, sigma2, tau)Arguments
theta | A |
sigma2 | A |
tau | A |
Value
Amatrix with the first column containing the second partial derivative with respect to\theta,the second column contains the partial derivative with respect to\theta and\sigma ^2,and lastly we have the second partial derivative with respect to\sigma ^2.
Process Haar WV Second Derivative
Taking the second derivative with respect to\theta yields:
\frac{{{\partial ^2}}}{{\partial {\theta ^2}}}\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}}}{{{\tau _j}}}
Taking the second derivative with respect to\sigma^2 yields:
\frac{{{\partial ^2}}}{{\partial {\sigma ^4}}}\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = 0
Taking the first derivative with respect to\theta and\sigma^2 yields:
\frac{\partial }{{\partial \theta }}\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{2(\theta + 1){\tau _j} - 6}}{{\tau _j^2}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for AR(1) process
Description
Obtain the first derivative of the AR(1) process.
Usage
deriv_ar1(phi, sigma2, tau)Arguments
phi | A |
sigma2 | A |
tau | A |
Value
Amatrix with the first column containing the partial derivative with respect to\phi and the second column contains the partial derivative with respect to\sigma ^2
Process Haar WV First Derivative
Taking the derivative with respect to\phi yields:
\frac{\partial }{{\partial \phi }}\nu _j^2\left( {\phi ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}\left( {\left( {{\phi ^2} - 1} \right){\tau _j}\left( { - 2{\phi ^{\frac{{{\tau _j}}}{2}}} + {\phi ^{{\tau _j}}} - \phi - 1} \right) - \left( {\phi \left( {3\phi + 2} \right) + 1} \right)\left( { - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + {\phi ^{{\tau _j}}} + 3} \right)} \right)}}{{{{\left( {\phi - 1} \right)}^4}{{\left( {\phi + 1} \right)}^2}\tau _j^2}}
Taking the derivative with respect to\sigma ^2 yields:
\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {\phi ,{\sigma ^2}} \right) = \frac{{\left( {{\phi ^2} - 1} \right){\tau _j} + 2\phi \left( { - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + {\phi ^{{\tau _j}}} + 3} \right)}}{{{{\left( {\phi - 1} \right)}^3}\left( {\phi + 1} \right)\tau _j^2}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for ARMA(1,1) process
Description
Obtain the first derivative of the ARMA(1,1) process.
Usage
deriv_arma11(phi, theta, sigma2, tau)Arguments
phi | A |
theta | A |
sigma2 | A |
tau | A |
Value
Amatrix with:
Thefirst column containing the partial derivative with respect to
\phi;Thesecond column containing the partial derivative with respect to
\theta;Thethird column contains the partial derivative with respect to
\sigma ^2.
Process Haar WV First Derivative
Taking the derivative with respect to\phi yields:
\frac{\partial }{{\partial \phi }}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}}}{{{{(\phi - 1)}^4}{{(\phi + 1)}^2}\tau _j^2}}\left( \begin{array}{cc}&{\tau _j}\left( { - {{(\theta + 1)}^2}(\phi - 1){{(\phi + 1)}^2} - 2\left( {{\phi ^2} - 1} \right)(\theta + \phi )(\theta \phi + 1){\phi ^{\frac{{{\tau _j}}}{2} - 1}} + \left( {{\phi ^2} - 1} \right)(\theta \phi + 1)(\theta + \phi ){\phi ^{{\tau _j} - 1}}} \right) \\&- \left( {{\theta ^2}((3\phi + 2)\phi + 1) + 2\theta \left( {\left( {{\phi ^2} + \phi + 3} \right)\phi + 1} \right) + (3\phi + 2)\phi + 1} \right)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right) \\ \end{array} \right)
Taking the derivative with respect to\theta yields:
\frac{\partial }{{\partial \theta }}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{{2{\sigma ^2}\left( {(\theta + 1)\left( {{\phi ^2} - 1} \right){\tau _j} + \left( {2\theta \phi + {\phi ^2} + 1} \right)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right)}}{{{{(\phi - 1)}^3}(\phi + 1)\tau _j^2}}
Taking the derivative with respect to\sigma^2 yields:
\frac{\partial }{{\partial \sigma ^2 }}\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = \frac{2 \sigma ^2 \left(\left(\phi ^2-1\right) \tau _j+2 \phi \left(\phi ^{\tau _j}-4 \phi ^{\frac{\tau _j}{2}}+3\right)\right)}{(\phi -1)^3 (\phi +1) \tau _j^2}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for Drift (DR) Process
Description
Obtain the first derivative of the Drift (DR) process.
Usage
deriv_dr(omega, tau)Arguments
omega | A |
tau | A |
Value
Amatrix with the first column containing the partial derivative with respect to\omega.
Process Haar WV First Derivative
Taking the derivative with respect to\omega yields:
\frac{\partial }{{\partial \omega }}\nu _j^2\left( \omega \right) = \frac{{\tau _j^2\omega }}{8}
Note: We are taking the derivative with respect to\omega and not\omega^2 as the\omegarelates to the slope of the process and not the processes variance like RW and WN. As a result, a second derivative exists and is not zero.
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for MA(1) process
Description
Obtain the first derivative of the MA(1) process.
Usage
deriv_ma1(theta, sigma2, tau)Arguments
theta | A |
sigma2 | A |
tau | A |
Value
Amatrix with the first column containing the partial derivative with respect to\thetaand the second column contains the partial derivative with respect to\sigma ^2
Process Haar WV First Derivative
Taking the derivative with respect to\theta yields:
\frac{\partial }{{\partial \theta }}\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{{\sigma ^2}\left( {2\left( {\theta + 1} \right){\tau _j} - 6} \right)}}{{\tau _j^2}}
Taking the derivative with respect to\sigma^2 yields:
\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{{{\left( {\theta + 1} \right)}^2}{\tau _j} - 6\theta }}{{\tau _j^2}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix for Quantization Noise (QN) Process
Description
Obtain the first derivative of the Quantization Noise (QN) process.
Usage
deriv_qn(tau)Arguments
tau | A |
Value
Amatrix with the first column containing the partial derivative with respect toQ^2.
Process Haar WV First Derivative
Taking the derivative with respect toQ^2 yields:
\frac{\partial }{{\partial {Q^2}}}\nu _j^2\left( {{Q^2}} \right) = \frac{6}{{\tau _j^2}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix Random Walk (RW) Process
Description
Obtain the first derivative of the Random Walk (RW) process.
Usage
deriv_rw(tau)Arguments
tau | A |
Value
Amatrix with the first column containingthe partial derivative with respect to\gamma^2.
Process Haar WV First Derivative
Taking the derivative with respect to\gamma ^2 yields:
\frac{\partial }{{\partial {\gamma ^2}}}\nu _j^2\left( {{\gamma ^2}} \right) = \frac{{\tau _j^2 + 2}}{{12{\tau _j}}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D Matrix for a Gaussian White Noise (WN) Process
Description
Obtain the first derivative of the Gaussian White Noise (WN) process.
Usage
deriv_wn(tau)Arguments
tau | A |
Value
Amatrix with the first column containing the partial derivative with respect to\sigma^2.
Process Haar WV First Derivative
Taking the derivative with respect to\sigma^2 yields:
\frac{\partial }{{\partial {\sigma ^2}}}\nu _j^2\left( {{\sigma ^2}} \right) = \frac{1}{{{\tau _j}}}
Author(s)
James Joseph Balamuta (JJB)
Analytic D matrix of Processes
Description
This function computes each process to WV (haar) in a given model.
Usage
derivative_first_matrix(theta, desc, objdesc, tau)Arguments
theta | A |
desc | A |
objdesc | A |
tau | A |
Details
Function returns the matrix effectively known as "D"
Value
Amatrix with the process derivatives going down the column
Author(s)
James Joseph Balamuta (JJB)
Create a ts.model from desc string
Description
Sets up the necessary backend for using Cpp functions to build R ts.model objects
Usage
desc.to.ts.model(desc)Arguments
desc | A |
Value
An S3 object with called ts.model with the following structure:
desc
theta
Author(s)
James Balamuta
Examples
desc.to.ts.model(c("AR1","WN"))Discrete Fourier Transformation for Autocovariance Function
Description
Calculates the autovariance function (ACF) using Discrete Fourier Transformation.
Usage
dft_acf(x)Arguments
x | A |
Details
This implementation is 2x as slow as Rs. Two issues: 1. memory resize and 2. unoptimized fft algorithm in arma.Consider piping back into R and rewrapping the object. (Decrease of about 10 microseconds.)
Value
Avec containing the ACF.
Box-Pierce
Description
Performs the Box-Pierce test to assess the Null Hypothesis of Independencein a Time Series
Usage
diag_boxpierce(x, order = NULL, stop_lag = 20, stdres = FALSE, plot = TRUE)Arguments
x | An |
order | An |
stop_lag | An |
stdres | A |
plot | A logical. If |
Author(s)
James Balamuta, Stéphane Guerrier, Yuming Zhang
Ljung-Box
Description
Performs the Ljung-Box test to assess the Null Hypothesis of Independencein a Time Series
Usage
diag_ljungbox(x, order = NULL, stop_lag = 20, stdres = FALSE, plot = TRUE)Arguments
x | An |
order | An |
stop_lag | An |
stdres | A |
plot | A logical. If |
Author(s)
James Balamuta, Stéphane Guerrier, Yuming Zhang
Diagnostic Plot of Residuals
Description
This function will plot 8 diagnostic plots to assess the model used to fit the data. These include: (1) residuals plot, (2) residuals vs fitted values, (3) histogram of distribution of standardized residuals, (4) Normal Q-Q plot of residuals, (5) ACF plot, (6) PACF plot, (7) Haar Wavelet Variance Representation,(8) Box test results.
Usage
diag_plot(Xt = NULL, model = NULL, resids = NULL, std = FALSE)Arguments
Xt | The data used to construct said model. |
model | A |
resids | A |
std | A |
Author(s)
Yuming Zhang
Portmanteau Tests
Description
Performs the Portmanteau test to assess the Null Hypothesis of Independencein a Time Series
Usage
diag_portmanteau_( x, order = NULL, stop_lag = 20, stdres = FALSE, test = "Ljung-Box", plot = TRUE)Arguments
x | An |
order | An |
stop_lag | An |
stdres | A |
test | A |
plot | A logical. If |
Author(s)
James Balamuta, Stéphane Guerrier, Yuming Zhang
Lagged Differences in Armadillo
Description
Returns the ith difference of a time series of rth lag.
Usage
diff_cpp(x, lag, differences)Arguments
x | A |
lag | A |
differences | A |
Value
Avector containing the differenced time series.
Author(s)
JJB
Root Finding C++
Description
Used to interface with Armadillo
Usage
do_polyroot_arma(z)Arguments
z | A |
Root Finding C++
Description
Vroom Vroom
Usage
do_polyroot_cpp(z)Arguments
z | A |
Drift to WV
Description
This function compute the WV (haar) of a Drift process
Usage
dr_to_wv(omega, tau)Arguments
omega | A |
tau | A |
Value
Avec containing the wavelet variance of the drift.
Process Haar Wavelet Variance Formula
The Drift (DR) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {{\omega }} \right) = \frac{{\tau _j^2{\omega ^2}}}{{16}}
Discrete Wavelet Transform
Description
Calculation of the coefficients for the discrete wavelet transformation.
Usage
dwt_cpp(x, filter_name, nlevels, boundary, brickwall)Arguments
x | A |
filter_name | A |
nlevels | An |
boundary | A |
brickwall | A |
Details
Performs a level J decomposition of the time series using the pyramid algorithm
Value
y Afield<vec> that contains the wavelet coefficients for each decomposition level
Author(s)
JJB
Expected value DR
Description
This function computes the expected value of a drift process.
Usage
e_drift(omega, n_ts)Arguments
omega | A |
n_ts | An |
Value
Avec containing the expected value of the drift.
Fit a Time Series Model to Data
Description
This function can fit a time series model to data using different methods.
Usage
estimate(model, Xt, method = "mle", demean = TRUE)Arguments
model | A time series model. |
Xt | A |
method | A |
demean | A |
Author(s)
Stéphane Guerrier and Yuming Zhang
Examples
Xt = gen_gts(300, AR(phi = c(0, 0, 0.8), sigma2 = 1))plot(Xt)estimate(AR(3), Xt)Xt = gen_gts(300, MA(theta = 0.5, sigma2 = 1))plot(Xt)estimate(MA(1), Xt, method = "gmwm")Xt = gen_gts(300, ARMA(ar = c(0.8, -0.5), ma = 0.5, sigma2 = 1))plot(Xt)estimate(ARMA(2,1), Xt, method = "rgmwm")Xt = gen_gts(300, ARIMA(ar = c(0.8, -0.5), i = 1, ma = 0.5, sigma2 = 1))plot(Xt)estimate(ARIMA(2,1,1), Xt, method = "mle")Xt = gen_gts(1000, SARIMA(ar = c(0.5, -0.25), i = 0, ma = 0.5, sar = -0.8, si = 1, sma = 0.25, s = 24, sigma2 = 1))plot(Xt)estimate(SARIMA(ar = 2, i = 0, ma = 1, sar = 1, si = 1, sma = 1, s = 24), Xt, method = "rgmwm")Evalute a time series or a list of time series models
Description
This function calculates AIC, BIC and HQ or the MAPE for a list of time seriesmodels. This function currently only supports models estimated by the MLE.
Usage
evaluate( models, Xt, criterion = "IC", start = 0.8, demean = TRUE, print = TRUE)Arguments
models | A time series model or a list of time series models. |
Xt | A time series (i.e gts object). |
criterion | Either "IC" for AIC, BIC and HQ or "MAPE" for MAPE. |
start | A |
demean | A |
print | logical. If |
Value
AIC, BIC and HQ or MAPE
Author(s)
Stéphane Guerrier
Examples
set.seed(18)n = 300Xt = gen_gts(n, AR(phi = c(0, 0, 0.8), sigma2 = 1))evaluate(AR(1), Xt)evaluate(list(AR(1), AR(3), MA(3), ARMA(1,2), SARIMA(ar = 1, i = 0, ma = 1, sar = 1, si = 1, sma = 1, s = 12)), Xt)evaluate(list(AR(1), AR(3)), Xt, criterion = "MAPE")Computes the (MODWT) wavelet covariance matrix using Chi-square confidence interval bounds
Description
Calculates the (MODWT) wavelet covariance matrix using Chi-square confidence interval bounds
Usage
fast_cov_cpp(ci_hi, ci_lo)Arguments
ci_hi | A |
ci_lo | A |
Value
A diagonal matrix.
Transform an Armadillo field<vec> to a matrix
Description
Unlists vectors in a field and places them into a matrix
Usage
field_to_matrix(x)Arguments
x | A |
Value
Amat containing the field elements within a column.
Author(s)
JJB
Find the Common Denominator of the Models
Description
Determines the common denominator among models
Usage
find_full_model(x)Arguments
x | A |
Value
Avector<string> that contains the terms of the common denominator of all models
fk14 filter construction
Description
Creates the fk14 filter
Usage
fk14_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
fk22 filter construction
Description
Creates the fk22 filter
Usage
fk22_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
fk4 filter construction
Description
Creates the fk4 filter
Usage
fk4_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
fk6 filter construction
Description
Creates the fk6 filter
Usage
fk6_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
fk8 filter construction
Description
Creates the fk8 filter
Usage
fk8_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Format the Confidence Interval for Estimates
Description
Creates hi and lo confidence based on SE and alpha.
Usage
format_ci(theta, se, alpha)Arguments
theta | A |
se | A |
alpha | A |
Value
Amat that has:
Column 1: Lo CI
Column 2: Hi CI
Column 3: SE
Generate an Autoregressive Order 1 ( AR(1) ) sequence
Description
Generate an Autoregressive Order 1 sequence given\phi and\sigma^2.
Usage
gen_ar1(N, phi = 0.3, sigma2 = 1)Arguments
N | An |
phi | A |
sigma2 | A |
Details
The function implements a way to generate the AR(1)'sx_t valueswithout calling the general ARMA function.Thus, the function is able to generate values much faster thangen_arma.
Value
Avec containing the AR(1) process.
Process Definition
The Autoregressive order 1 (AR1) process with non-zero parameter\phi \in (-1,+1) and\sigma^2 \in {\rm I\!R}^{2}.This process is defined as:
{X_t} = {\phi _1}{X_{t - 1}} + {\varepsilon_t}
,where
{\varepsilon_t}\mathop \sim \limits^{iid} N\left( {0,\sigma^2} \right)
AR(1) processes are sometimes used as an approximation for Bias Instability noises.
Generation Algorithm
The function first generates a vector of White Noise with lengthN+1 usinggen_wn and then obtains theautoregressive values under the above process definition.
TheX_0 (first value ofX_t) is discarded.
Generate AR(1) Block Process
Description
This function allows us to generate a non-stationary AR(1) block process.
Usage
gen_ar1blocks(phi, sigma2, n_total, n_block, scale = 10, title = NULL, seed = 135, ...)Arguments
phi | A |
sigma2 | A |
n_total | An |
n_block | An |
scale | An |
title | A |
seed | An |
... | Additional parameters. |
Value
Avector containing the AR(1) block process.
Note
This function generates a non-stationary AR(1) block process whose theoretical maximum overlapping allan variance (MOAV) is different from the theoretical MOAV of a stationary AR(1) process. This difference in the value of the allan variance between stationary and non-stationary processes has been shown through the calculation of the theoretical allan variance given in "A Study of the Allan Variance for Constant-Mean Non-Stationary Processes" by Xu et al. (IEEE Signal Processing Letters, 2017), preprint available:https://arxiv.org/abs/1702.07795.
Author(s)
Yuming Zhang and Haotian Xu
Examples
Xt = gen_ar1blocks(phi = 0.9, sigma2 = 1, n_total = 1000, n_block = 10, scale = 100)plot(Xt)Yt = gen_ar1blocks(phi = 0.5, sigma2 = 5, n_total = 800, n_block = 20, scale = 50)plot(Yt)Generate Autoregressive Order p, Integrated d, Moving Average Order q (ARIMA(p,d,q)) Model
Description
Generate an ARIMA(p,d,q) process with supplied vector of Autoregressive Coefficients (\phi), Integratedd, Moving Average Coefficients (\theta), and\sigma^2.
Usage
gen_arima(N, ar, d, ma, sigma2 = 1.5, n_start = 0L)Arguments
N | An |
ar | A |
d | An |
ma | A |
sigma2 | A |
n_start | An |
Details
The innovations are generated from a normal distribution.The\sigma^2 parameter is indeed a variance parameter. This differs from R's use of the standard deviation,\sigma.
Value
Avec that contains the generated observations.
Warning
Please note, this function will generate a sum ofN + d number of observations,whered denotes the number of differences necessary.
Generate Autoregressive Orderp - Moving Average Orderq (ARMA(p,q)) Model
Description
Generate an ARMA(p,q) process with supplied vector of Autoregressive Coefficients (\phi), Moving Average Coefficients (\theta), and\sigma^2.
Usage
gen_arma(N, ar, ma, sigma2 = 1.5, n_start = 0L)Arguments
N | An |
ar | A |
ma | A |
sigma2 | A |
n_start | An |
Details
ForAR(1),MA(1), andARMA(1,1) please use their functions if speed is importantas this function is designed to generate generic ARMA processes.
Value
Avec that contains the generated observations.
Process Definition
The Autoregressive orderp and Moving Average orderq (ARMA(p,q)) process with non-zero parameters\phi_i \in (-1,+1) for the AR components,\theta_j \in (-1,+1) for the MA components, and\sigma^2 \in {\rm I\!R}^{+}.This process is defined as:
{X_t} = \sum\limits_{i = 1}^p {{\phi _i}{X_{t - i}}} + \sum\limits_{i = 1}^q {{\theta _i}{\varepsilon _{t - i}}} + {\varepsilon _t}
where
{\varepsilon_t}\mathop \sim \limits^{iid} N\left( {0,\sigma^2} \right)
Generation Algorithm
The innovations are generated from a normal distribution.The\sigma^2 parameter is indeed a variance parameter. This differs from R's use of the standard deviation,\sigma.
Generate an ARMA(1,1) sequence
Description
Generate an ARMA(1,1) sequence given\phi,\theta, and\sigma^2.
Usage
gen_arma11(N, phi = 0.1, theta = 0.3, sigma2 = 1)Arguments
N | An |
phi | A |
theta | A |
sigma2 | A |
Details
The function implements a way to generate thex_t values without calling the general ARMA function.
Value
Avec containing the MA(1) process.
Process Definition
The Autoregressive order 1 and Moving Average order 1 (ARMA(1,1)) process with non-zero parameters\phi \in (-1,+1) for the AR component,\theta \in (-1,+1) for the MA component, and\sigma^2 \in {\rm I\!R}^{+}.This process is defined as:
{X_t} = {\phi _1}{X_{t - 1}} + {\theta _1}{\varepsilon_{t - 1}} + {\varepsilon_t}
,where
{\varepsilon_t}\mathop \sim \limits^{iid} N\left( {0,\sigma^2} \right)
Generation Algorithm
The function first generates a vector of white noise usinggen_wn and then obtains theARMA values under the above equation.
TheX_0 (first value ofX_t) is discarded.
Generate Bias-Instability Process
Description
This function allows to generate a non-stationary bias-instability process.
Usage
gen_bi(sigma2, n_total, n_block, title = NULL, seed = 135, ...)Arguments
sigma2 | A |
n_total | An |
n_block | An |
title | A |
seed | An |
... | Additional parameters. |
Value
Avector containing the bias-instability process.
Note
This function generates a non-stationary bias-instability processwhose theoretical maximum overlapping allan variance (MOAV) is close to the theoreticalMOAV of the best approximation of this process through a stationary AR(1) process over some scales. However, this approximation is not good enough when considering the logarithmic representation of the allan variance.Therefore, the exact form of the allan variance of this non-stationary process allows us to better interpret the signals characterized by bias-instability, as shown in "A Study of the Allan Variance for Constant-Mean Non-Stationary Processes" by Xu et al. (IEEE Signal Processing Letters, 2017), preprint available:https://arxiv.org/abs/1702.07795.
Author(s)
Yuming Zhang
Examples
Xt = gen_bi(sigma2 = 1, n_total = 1000, n_block = 10)plot(Xt)Yt = gen_bi(sigma2 = 0.8, n_total = 800, n_block = 20,title = "non-stationary bias-instability process")plot(Yt)Generate a Drift Process
Description
Simulates a Drift Process with a given slope,\omega.
Usage
gen_dr(N, omega = 5)Arguments
N | An |
omega | A |
Value
Avec containing the drift.
Process Definition
Drift with parameter\omega \in \Omega where\Omega is in{\rm I\!R}^{+} or{\rm I\!R}^{-}. This process is defined as:X_t = \omega t and is occasionally referred to as Rate Ramp.
Generation Algorithm
To generate the Drift process, we first fill avector with the\omega parameter.After, we take the cumulative sum along the vector.
Generate a Fractional Gaussian noise given\sigma^2 andH.
Description
Simulates a Fractional Gaussian noise given\sigma^2 andH.
Usage
gen_fgn(N, sigma2 = 1, H = 0.9)Arguments
N | An |
sigma2 | A |
H | A |
Value
fgn Avec containing the Fractional Gaussian noise process.
Generate Generic Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
Description
Generate an ARMA(P,Q) process with supplied vector of Autoregressive Coefficients (\phi), Moving Average Coefficients (\theta), and\sigma^2.
Usage
gen_generic_sarima(N, theta_values, objdesc, sigma2 = 1.5, n_start = 0L)Arguments
N | An |
theta_values | A |
objdesc | A |
sigma2 | A |
n_start | An |
Details
The innovations are generated from a normal distribution.The\sigma^2 parameter is indeed a variance parameter. This differs from R's use of the standard deviation,\sigma.
Value
Avec that contains the generated observations.
Simulate a simts TS object using a theoretical model
Description
Create agts object based on a time series model.
Usage
gen_gts( n, model, start = 0, end = NULL, freq = 1, unit_ts = NULL, unit_time = NULL, name_ts = NULL, name_time = NULL)Arguments
n | An |
model | A |
start | A |
end | A |
freq | A |
unit_ts | A |
unit_time | A |
name_ts | A |
name_time | A |
Details
This function accepts either ats.model object (e.g. AR1(phi = .3, sigma2 =1) + WN(sigma2 = 1)) or asimts object.
Value
Agts object
Author(s)
James Balamuta and Wenchao Yang
Examples
# Set seed for reproducibilityset.seed(1336)n = 1000# AR1 + WNmodel = AR1(phi = .5, sigma2 = .1) + WN(sigma2=1)x = gen_gts(n, model)plot(x)# Reset seedset.seed(1336)# GM + WN# Convert from AR1 to GM valuesm = ar1_to_gm(c(.5,.1),10)# Beta = 6.9314718, Sigma2_gm = 0.1333333model = GM(beta = m[1], sigma2_gm = m[2]) + WN(sigma2=1)x2 = gen_gts(n, model, freq = 10, unit_time = 'sec')plot(x2)# Same time seriesall.equal(x, x2, check.attributes = FALSE)Generate a Latent Time Series Object Based on a Model
Description
Simulate alts object based on a supplied time series model.
Usage
gen_lts( n, model, start = 0, end = NULL, freq = 1, unit_ts = NULL, unit_time = NULL, name_ts = NULL, name_time = NULL, process = NULL)Arguments
n | An |
model | A |
start | A |
end | A |
freq | A |
unit_ts | A |
unit_time | A |
name_ts | A |
name_time | A |
process | A |
Details
This function accepts either ats.model object (e.g. AR1(phi = .3, sigma2 =1) + WN(sigma2 = 1)) or asimts object.
Value
Alts object with the following attributes:
- start
The time of the first observation.
- end
The time of the last observation.
- freq
Numeric representation of the sampling frequency/rate.
- unit
A string reporting the unit of measurement.
- name
Name of the generated dataset.
- process
A
vectorthat contains model names of decomposed and combined processes
Author(s)
James Balamuta, Wenchao Yang, and Justin Lee
Examples
# ARset.seed(1336)model = AR1(phi = .99, sigma2 = 1) + WN(sigma2 = 1)test = gen_lts(1000, model)plot(test)Generate Latent Time Series based on Model (Internal)
Description
Create a latent time series based on a supplied time series model.
Usage
gen_lts_cpp(N, theta, desc, objdesc)Arguments
N | An |
theta | A |
desc | A |
objdesc | A |
Value
Amat containing data for each decomposed and combined time series.
Generate an Moving Average Order 1 (MA(1)) Process
Description
Generate an MA(1) Process given\theta and\sigma^2.
Usage
gen_ma1(N, theta = 0.3, sigma2 = 1)Arguments
N | An |
theta | A |
sigma2 | A |
Details
The function implements a way to generate thex_t values without calling the general ARMA function.
Value
Avec containing the MA(1) process.
Process Definition
The Moving Average order 1 (MA(1)) process with non-zero parameter\theta \in (-1,+1) and\sigma^2 \in {\rm I\!R}^{+}. This process is defined as:
{x_t} = {\varepsilon_t} + {\theta _1}{\varepsilon_{t - 1}}
,where
{\varepsilon_t}\mathop \sim \limits^{iid} N\left( {0,\sigma^2} \right)
Generation Algorithm
The function first generates a vector of white noise usinggen_wn and then obtains theMA values under the above equation.
TheX_0 (first value ofX_t) is discarded.
Generate a Matern Process given\sigma^2,\lambda and\alpha.
Description
Simulates a Matern Process given\sigma^2,\lambda and\alpha.
Usage
gen_matern(N, sigma2 = 1, lambda = 0.35, alpha = 0.9)Arguments
N | An |
sigma2 | A |
lambda | A |
alpha | A |
Value
mtp Avec containing the Matern Process.
Generate a determinist vector returned by the matrix by vector product of matrixX and vector\beta.
Description
Generate a determinist vector returned by the matrix by vector product of matrixX and vector\beta.
Usage
gen_mean(X, beta)Arguments
X | A |
beta | A |
Value
mean_vec Avec containing the determinist vector.
Generate Time Series based on Model (Internal)
Description
Create a time series process based on a suppliedts.model.
Usage
gen_model(N, theta, desc, objdesc)Arguments
N | An |
theta | A |
desc | A |
objdesc | A |
Value
Avec that contains combined time series.
Generate Non-Stationary White Noise Process
Description
This function allows to generate a non-stationary white noise process.
Usage
gen_nswn(n_total, title = NULL, seed = 135, ...)Arguments
n_total | An |
title | A |
seed | An |
... | Additional parameters. |
Value
Avector containing the non-stationary white noise process.
Note
This function generates a non-stationary white noise process whose theoretical maximum overlapping allan variance (MOAV) corresponds to the theoretical MOAV of the stationary white noise process. This example confirms that the allan variance is unable to distinguish between a stationary white noise process and a white noise process whose second-order behavior is non-stationary, as pointed out in the paper "A Study of the Allan Variance for Constant-Mean Non-Stationary Processes" by Xu et al. (IEEE Signal Processing Letters, 2017), preprint available:https://arxiv.org/abs/1702.07795.
Author(s)
Yuming Zhang
Examples
Xt = gen_nswn(n_total = 1000)plot(Xt)Yt = gen_nswn(n_total = 2000, title = "non-stationary white noise process", seed = 1960)plot(Yt)Generate a Power Law Process given\sigma^2 andd.
Description
Simulates a a Power Law Process given\sigma^2 andd.
Usage
gen_powerlaw(N, sigma2 = 1, d = 0.9)Arguments
N | An |
sigma2 | A |
d | A |
Value
plp Avec containing the Power Law Process.
Generate a Quantisation Noise (QN) or Rounding Error Sequence
Description
Simulates a QN sequence givenQ^2.
Usage
gen_qn(N, q2 = 0.1)Arguments
N | An |
q2 | A |
Value
Avec containing the QN process.
Process Definition
Quantization Noise (QN) with parameterQ^2 \in R^{+}. With i.i.dY_t \sim U(0,1) (i.e. a standard uniform variable), this process isdefined as:
X_t = \sqrt{12Q^2}(Y_{t}-Y_{t-1})
Generation Algorithm
To generate the quantisation noise, we follow this recipe:First, we generate using a random uniform distribution:
U_k^*\sim U\left[ {0,1} \right]
Then, we multiple the sequence by\sqrt{12} so:
{U_k} = \sqrt{12} U_k^*
Next, we find the derivative of{U_k}
{{\dot U}_k} = \frac{{{U_{k + \Delta t}} - {U_k}}}{{\Delta t}}
In this case, we modify the derivative such that:{{\dot U}_k}\Delta t = {U_{k + \Delta t}} - {U_k}
Thus, we end up with:
{x_k} = \sqrt Q {{\dot U}_k}\Delta t
{x_k} = \sqrt Q \left( {{U_{k + 1}} - {U_k}} \right)
Generate a Random Walk without Drift
Description
Generates a random walk without drift.
Usage
gen_rw(N, sigma2 = 1)Arguments
N | An |
sigma2 | A |
Value
grw Avec containing the random walk without drift.
Process Definition
Random Walk (RW) with parameter\gamma^2 \in {\rm I\!R}^{+}. This process is defined as:
{X_t} = \sum\limits_{t = 1}^T {\gamma {Z_t}}
and is often calledRate Random Walk in the engineering literature.
Generation Algorithm
To generate we first obtain the standard deviation from the variance by taking a square root. Then, we sampleN times from aN(0,\sigma^2) distribution. Lastly, we take thecumulative sum over the vector.
Generate Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
Description
Generate an ARMA(P,Q) process with supplied vector of Autoregressive Coefficients (\phi), Moving Average Coefficients (\theta), and\sigma^2.
Usage
gen_sarima(N, ar, d, ma, sar, sd, sma, sigma2 = 1.5, s = 12L, n_start = 0L)Arguments
N | An |
ar | A |
d | An |
ma | A |
sar | A |
sd | An |
sma | A |
sigma2 | A |
s | An |
n_start | An |
Details
The innovations are generated from a normal distribution.The\sigma^2 parameter is indeed a variance parameter. This differs from R's use of the standard deviation,\sigma.
Value
Avec that contains the generated observations.
Generate Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
Description
Generate an ARMA(P,Q) process with supplied vector of Autoregressive Coefficients (\phi), Moving Average Coefficients (\theta), and\sigma^2.
Usage
gen_sarma(N, ar, ma, sar, sma, sigma2 = 1.5, s = 12L, n_start = 0L)Arguments
N | An |
ar | A |
ma | A |
sar | A |
sma | A |
sigma2 | A |
s | An |
n_start | An |
Details
The innovations are generated from a normal distribution.The\sigma^2 parameter is indeed a variance parameter. This differs from R's use of the standard deviation,\sigma.
Value
Avec that contains the generated observations.
Generate a Sinusoidal Process given\alpha^2 and\beta.
Description
Simulates a Sinusoidal Process Process with parameter\alpha^2 and\beta
Usage
gen_sin(N, alpha2 = 9e-04, beta = 0.06, U = 1)Arguments
N | An |
alpha2 | A |
beta | A |
Value
sn Avec containing the sinusoidal process.
Generation Algorithm
The function first generates a initial cycle oscillation at t=0 from a Uniform law with parameter a = 0 and b = 2 * pi and then compute the signal from its definition
X_t = \alpha \sin(\beta t + U)
.
Generate a Gaussian White Noise Process (WN(\sigma ^2))
Description
Simulates a Gaussian White Noise Process with variance parameter\sigma ^2.
Usage
gen_wn(N, sigma2 = 1)Arguments
N | An |
sigma2 | A |
Value
wn Avec containing the white noise.
Process Definition
Gaussian White Noise (WN) with parameter\sigma^2 \in {\rm I\!R}^{+}.This process is defined asX_t\sim N(0,\sigma^2) andis sometimes referred to as Angle (Velocity) Random Walk.
Generation Algorithm
To generate the Gaussian White Noise (WN) process, we first obtain the standard deviation from the variance by taking a square root. Then, we sampleN times from aN(0,\sigma ^2) distribution.
Retrieve GMWM starting value from Yannick's objective function
Description
Obtains the GMWM starting value given by Yannick's objective function optimization
Usage
getObjFun(theta, desc, objdesc, model_type, omega, wv_empir, tau)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
omega | A |
wv_empir | A |
tau | A |
Value
Adouble that is the value of the Objective function under Yannick's starting algorithm
Retrieve GMWM starting value from Yannick's objective function
Description
Obtains the GMWM starting value given by Yannick's objective function optimization
Usage
getObjFunStarting(theta, desc, objdesc, model_type, wv_empir, tau)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
wv_empir | A |
tau | A |
Value
Adouble that is the value of the Objective function under Yannick's starting algorithm
Routing function for summary info
Description
Gets all the data for the summary.gmwm function.
Usage
get_summary( theta, desc, objdesc, model_type, wv_empir, theo, scales, V, omega, obj_value, N, alpha, robust, eff, inference, fullV, bs_gof, bs_gof_p_ci, bs_theta_est, bs_ci, B)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
wv_empir | A |
theo | A |
scales | A |
V | A |
omega | A |
obj_value | A |
N | A |
alpha | A |
robust | A |
eff | A |
inference | A |
fullV | A |
bs_gof | A |
bs_gof_p_ci | A |
bs_ci | A |
B | A |
Value
Afield<mat> that contains bootstrapped / asymptotic GoF results as well as CIs.
Transform GM to AR1
Description
Takes GM values and transforms them to AR1
Usage
gm_to_ar1(theta, freq)Arguments
theta | A |
freq | A |
Value
Avec containing GM values.
Author(s)
James BalamutaThe function takes a vector of GM values\beta and\sigma ^2_{gm}and transforms them to AR1 values\phi and\sigma ^2using the formulas:\phi = \exp \left( { - \beta \Delta t} \right){\sigma ^2} = \sigma _{gm}^2\left( {1 - \exp \left( { - 2\beta \Delta t} \right)} \right)
Generalized Method of Wavelet Moments (GMWM)
Description
Performs estimation of time series models by using the GMWM estimator.
Usage
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 |
data | A |
model.type | A |
compute.v | A |
robust | A |
eff | A |
alpha | A |
seed | An |
G | An |
K | An |
H | An |
freq | A |
Details
This function is under work. Some of the features are active. Others... Not so much.
The V matrix is calculated by:diag\left[ {{{\left( {Hi - Lo} \right)}^2}} \right].
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)^25. Optimize the values to obtain\hat{\theta}6. If FAST = TRUE, return these results. Else, continue.
Loop k = 1 to KLoop h = 1 to H7. Simulate xt underF_{\hat{\theta}}8. Compute WV EmpiricalEND9. Calculate the covariance matrix10. Optimize the values to obtain\hat{\theta}END11. Return optimized values.
The function estimates a variety of time series models. If type = "imu" or "ssm", thenparameter vector should indicate the characters of the models that compose the latent or state-space model. The modeloptions 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 valuesIf robust = TRUE the function takes the robust estimate of the wavelet variance to be used in the GMWM estimation procedure.
Value
Agmwm 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.modelsupplied to gmwmmodel.hat: A new value of
ts.modelobject supplied to gmwmstarting: Indicates whether the procedure used the initial guessing approach
seed: Randomization seed used to generate the guessing values
freq: Frequency of data
Engine for obtaining the GMWM Estimator
Description
This function uses the Generalized Method of Wavelet Moments (GMWM) to estimate the parameters of a time series model.
Usage
gmwm_engine( theta, desc, objdesc, model_type, wv_empir, omega, scales, starting)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
wv_empir | A |
omega | A |
scales | A |
starting | A |
Details
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)- "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 model_type = "imu" or type = "ssm" thenstarting values pass through an initial bootstrap and pseudo-optimization before being passed to the GMWM optimization.If robust = TRUE the function takes the robust estimate of the wavelet variance to be used in the GMWM estimation procedure.
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
References
Wavelet variance based estimation for composite stochastic processes, S. Guerrier and Robust Inference for Time Series Models: a Wavelet-Based Framework, S. Guerrier
GMWM for (Robust) Inertial Measurement Units (IMUs)
Description
Performs the GMWM estimation procedure using a parameter transform and samplingscheme specific to IMUs.
Usage
gmwm_imu(model, data, compute.v = "fast", robust = F, eff = 0.6, ...)Arguments
model | A |
data | A |
compute.v | A |
robust | A |
eff | A |
... | Other arguments passed to the main gmwm function |
Details
This version of the gmwm function has customized settingsideal for modeling with an IMU object. If you seek to model with an GaussMarkov,GM, object. Please note results depend on thefreq specified in the data construction step within theimu. If you wish for results to be stable but lose theability to interpret with respect tofreq, then useAR1 terms.
Value
Agmwm 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 |
|
model.hat | A new value of |
starting | Indicates whether the procedure used the initial guessing approach |
seed | Randomization seed used to generate the guessing values |
freq | Frequency of data |
Master Wrapper for the GMWM Estimator
Description
This function generates WV, GMWM Estimator, and an initial test estimate.
Usage
gmwm_master_cpp( data, theta, desc, objdesc, model_type, starting, alpha, compute_v, K, H, G, robust, eff)Arguments
data | A |
theta | A |
desc | A |
objdesc | A |
model_type | A |
starting | A |
alpha | A |
compute_v | A |
K | An |
H | An |
G | An |
robust | A |
eff | A |
Value
Afield<mat> that contains a list of ever-changing estimates...
Author(s)
JJB
References
Wavelet variance based estimation for composite stochastic processes, S. Guerrier and Robust Inference for Time Series Models: a Wavelet-Based Framework, S. Guerrier
Bootstrap for Estimating Both Theta and Theta SD
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters, obtain the wavelet variance, and then V.
Usage
gmwm_param_bootstrapper( theta, desc, objdesc, scales, model_type, N, robust, eff, alpha, H)Arguments
theta | A |
desc | A |
objdesc | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Bootstrap for Standard Deviations of Theta Estimates
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters
Usage
gmwm_sd_bootstrapper( theta, desc, objdesc, scales, model_type, N, robust, eff, alpha, H)Arguments
theta | A |
desc | A |
objdesc | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Update Wrapper for the GMWM Estimator
Description
This function uses information obtained previously (e.g. WV covariance matrix) to re-estimate a different model parameterization
Usage
gmwm_update_cpp( theta, desc, objdesc, model_type, N, expect_diff, ranged, orgV, scales, wv, starting, compute_v, K, H, G, robust, eff)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
scales | A |
starting | A |
Value
Afield<mat> that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
References
Wavelet variance based estimation for composite stochastic processes, S. Guerrier and Robust Inference for Time Series Models: a Wavelet-Based Framework, S. Guerrier
Compute the GOF Test
Description
yaya
Usage
gof_test(theta, desc, objdesc, model_type, tau, v_hat, wv_empir)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
tau | A |
v_hat | A |
wv_empir | A |
Value
Avec that has
Test Statistic
P-Value
DF
Create a simts TS object using time series data
Description
Takes a time series and turns it into a time series oriented object that can be used for summary and graphing functions in thesimts package.
Usage
gts( data, start = 0, end = NULL, freq = 1, unit_ts = NULL, unit_time = NULL, name_ts = NULL, name_time = NULL, data_name = NULL, Time = NULL, time_format = NULL)Arguments
data | A one-column |
start | A |
end | A |
freq | A |
unit_ts | A |
unit_time | A |
name_ts | A |
name_time | A |
data_name | A |
Time | A numeric or character |
time_format | A |
Value
Agts object
Author(s)
James Balamuta and Wenchao Yang
Examples
m = data.frame(rnorm(50))x = gts(m, unit_time = 'sec', name_ts = 'example')plot(x)x = gen_gts(50, WN(sigma2 = 1))x = gts(x, freq = 100, unit_time = 'sec')plot(x)Time of a gts object
Description
Extracting the time of a gts object
Usage
gts_time(x)Value
Time vector of a gts object.
Author(s)
Stéphane Guerrier
Randomly guess a starting parameter
Description
Sets starting parameters for each of the given parameters.
Usage
guess_initial( desc, objdesc, model_type, num_param, expect_diff, N, wv, tau, ranged, G)Arguments
desc | A |
objdesc | A |
model_type | A |
num_param | An |
expect_diff | A |
N | A |
tau | A |
G | A |
Value
Avec containing smart parameter starting guesses to be iterated over.
Randomly guess a starting parameter
Description
Sets starting parameters for each of the given parameters.
Usage
guess_initial_old( desc, objdesc, model_type, num_param, expect_diff, N, wv_empir, tau, B)Arguments
desc | A |
objdesc | A |
model_type | A |
num_param | An |
expect_diff | A |
N | A |
wv_empir | A |
tau | A |
B | A |
Value
Avec containing smart parameter starting guesses to be iterated over.
Haar filter construction
Description
Creates the haar filter
Usage
haar_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Obtain the value of an object's properties
Description
Used to access different properties of thegts,imu, orlts object.
Usage
has(x, type)## S3 method for class 'imu'has(x, type)Arguments
x | A |
type | A |
Details
To access information aboutimu properties use:
"accel"Returns whether accelerometers have been specified
"gyro"Returns whether accelerometers have been specified
"sensors"Returns whether there exists both types of sensors
Value
The method will return a single TRUE or FALSE response
Methods (by class)
has(imu): Accessimuobject properties
Author(s)
James Balamuta
Mean Monthly Precipitation, from 1907 to 1972
Description
Hydrology data that indicates a robust approach may be preferred to aclassical approach when estimating time series.
Usage
hydroFormat
A time series object with frequency 12 starting at 1907 and going to 1972for a total of 781 observations.
Source
datamarket, mean-monthly-precipitation-1907-1972
Indirect Inference for ARMA
Description
Option for indirect inference
Usage
idf_arma(ar, ma, sigma2, N, robust, eff, H)Arguments
ar | A |
ma | A |
sigma2 | A |
N | A |
robust | A |
eff | A |
H | A |
Value
Avec with the indirect inference results.
Indirect Inference for ARMA
Description
Option for indirect inference
Usage
idf_arma_total(ar, ma, sigma2, N, robust, eff, H)Arguments
ar | A |
ma | A |
sigma2 | A |
N | A |
robust | A |
eff | A |
H | A |
Value
Avec with the indirect inference results.
Create an IMU Object
Description
Builds an IMU object that provides the program with gyroscope, accelerometer, and axis information per column in the dataset.
Usage
imu( data, gyros = NULL, accels = NULL, axis = NULL, freq = NULL, unit = NULL, name = NULL)Arguments
data | A |
gyros | A |
accels | A |
axis | A |
freq | An |
unit | A |
name | A |
Details
data can be a numeric vector, matrix or data frame.
gyros andaccels cannot beNULL at the same time, but it will be fine if one of them isNULL.In the new implementation, the length ofgyros andaccels do not need to be equal.
Inaxis, duplicate elements are not alowed for each sensor. In the new implementation, please specify the axis for each column of data.axis will be automatically generated if there are less than or equal to 3 axises for each sensor.
Value
Animu object in the following attributes:
- sensor
A
vectorthat indicates whether data contains gyroscope sensor, accelerometer sensor, or both.- num.sensor
A
vectorthat indicates how many columns of data are for gyroscope sensor and accelerometer sensor.- axis
Axis value such as 'X', 'Y', 'Z'.
- freq
Observations per second.
- unit
String representation of the unit.
- name
Name of the dataset.
Author(s)
James Balamuta and Wenchao Yang
Examples
## Not run: if(!require("imudata")){ install_imudata() library("imudata")}data(imu6)# Example 1 - Only gyrostest1 = imu(imu6, gyros = 1:3, axis = c('X', 'Y', 'Z'), freq = 100)df1 = wvar.imu(test1)plot(df1)# Example 2 - One gyro and one accelerometertest2 = imu(imu6, gyros = 1, accels = 4, freq = 100)df2 = wvar.imu(test2)plot(df2)# Example 3 - 3 gyros and 3 accelerometerstest3 = imu(imu6, gyros = 1:3, accels = 4:6, axis = c('X', 'Y', 'Z', 'X', 'Y', 'Z'), freq = 100)df3 = wvar.imu(test3)plot(df3)# Example 4 - Custom axistest4 = imu(imu6, gyros = 1:2, accels = 4:6, axis = c('X', 'Y', 'X', 'Y', 'Z'), freq = 100)df4 = wvar.imu(test4)plot(df4)## End(Not run)Pulls the IMU time from the IMU object
Description
Helper function for the IMU object to accessrownames() with a numeric conversion.
Usage
imu_time(x)Arguments
x | A |
Value
Avector with numeric information.
Discrete Intergral: Inverse Difference
Description
Takes the inverse difference (e.g. goes from diff() result back to previous vector)
Usage
intgr_vec(x, xi, lag)diff_inv_values(x, lag, d, xi)diff_inv(x, lag, d)Arguments
x | A |
xi | A |
lag | An |
d | An |
Check Invertibility Conditions
Description
Checks the invertiveness of series of coefficients.
Usage
invert_check(x)Arguments
x | A |
Value
True (if outside unit circle) || False (if inside unit circle)
Is simts Object
Description
Is the object agts,imu, orlts object?
Usage
is.gts(x)is.imu(x)is.lts(x)is.ts.model(x)Arguments
x | A |
Details
Usesinherits overis for speed.
Value
Alogical value that indicates whether the object is of that class (TRUE) or not (FALSE).
Author(s)
James Balamuta
Integer Check
Description
Checks whether the submitted value is an integer
Usage
is.whole(x)Arguments
x | A |
Value
Aboolean value indicating whether the value is an integer or not.
Author(s)
James Balamuta
Examples
is.whole(2.3)is.whole(4)is.whole(c(1,2,3))is.whole(c(.4,.5,.6))is.whole(c(7,.8,9))Calculates the Jacobian for the ARMA process
Description
Take the numerical derivative for the first derivative of an ARMA using the 2 point rule.
Usage
jacobian_arma(theta, p, q, tau)Arguments
theta | A |
p | A |
q | A |
tau | A |
Value
Amat that returns the first numerical derivative of the ARMA process.
Author(s)
James Joseph Balamuta (JJB)
la16 filter construction
Description
Creates the la16 filter
Usage
la16_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
la20 filter construction
Description
Creates the la20 filter
Usage
la20_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
la8 filter construction
Description
Creates the la8 filter
Usage
la8_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
MLR in Armadillo
Description
Perform Multiple Linear Regression using armadillo in C++
Usage
lm_arma(y, X)Arguments
y | A |
X | A |
Value
Afield<vec> with:
- coef
Coefficients
- resid
Residuals
- sigma2
Sigma^2
Linear Regression with Drift
Description
Perform a linear regression with drift.
Usage
lm_dr(x)Arguments
x | A |
Value
Afield<vec> with:
- coef
Coefficients
- resid
Residuals
- sigma2
Sigma^2
Logit Function
Description
This function computes the logit link function.
Usage
logit(x)Arguments
x | A |
Value
Avec containing logit terms.
Author(s)
James Joseph Balamuta (JJB)
Logit2 Function
Description
This function computes the logit2 link function.
Usage
logit2(x)Arguments
x | A |
Value
Avec containing logit terms.
Author(s)
James Joseph Balamuta (JJB)
Logit2 Inverse Function
Description
This function computes the inverse of a logit transformation of the parameters.
Usage
logit2_inv(x)Arguments
x | A |
Value
Avec containing logit probabilities.
Author(s)
James Joseph Balamuta (JJB)
Logit Inverse Function
Description
This function computes the inverse of a logit transformation of the parameters.
Usage
logit_inv(x)Arguments
x | A |
Value
Avec containing logit probabilities.
Author(s)
James Joseph Balamuta (JJB)
Generate a Latent Time Series Object from Data
Description
Create alts object based on a supplied matrix or data frame. The latent time series is obtained by the sum of underlying time series.
Usage
lts( data, start = 0, end = NULL, freq = 1, unit_ts = NULL, unit_time = NULL, name_ts = NULL, name_time = NULL, process = NULL)Arguments
data | A multiple-column |
start | A |
end | A |
freq | A |
unit_ts | A |
unit_time | A |
name_ts | A |
name_time | A |
process | A |
Value
Alts object
Author(s)
Wenchao Yang and Justin Lee
Examples
model1 = AR1(phi = .99, sigma2 = 1) model2 = WN(sigma2 = 1)col1 = gen_gts(1000, model1)col2 = gen_gts(1000, model2)testMat = cbind(col1, col2, col1+col2)testLts = lts(testMat, unit_time = 'sec', process = c('AR1', 'WN', 'AR1+WN'))plot(testLts)Second moment DR
Description
This function computes the second moment of a drift process.
Usage
m2_drift(omega, n_ts)Arguments
omega | A |
n_ts | An |
Value
Avec containing the second moment of the drift.
Moving Average Order 1 (MA(1)) to WV
Description
This function computes the WV (haar) of a Moving Average order 1 (MA1) process.
Usage
ma1_to_wv(theta, sigma2, tau)Arguments
theta | A |
sigma2 | A |
tau | A |
Details
This function is significantly faster than its generalized counter partarma_to_wv.
Value
Avec containing the wavelet variance of the MA(1) process.
Process Haar Wavelet Variance Formula
The Moving Average Order1 (MA(1)) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{\left( {{{\left( {\theta + 1} \right)}^2}{\tau _j} - 6\theta } \right){\sigma ^2}}}{{\tau _j^2}}
Default utility function for various plots titles
Description
Adds title, grid, and required x- and y-axes.
Usage
make_frame( x_range, y_range, xlab, ylab, main = "", mar = c(5.1, 5.1, 1, 2.1), add_axis_x = TRUE, add_axis_y = TRUE, col_box = "black", col_grid = "grey95", col_band = "grey95", col_title = "black", add_band = TRUE, title_band_width = 0.09, grid_lty = 1)Arguments
x_range | A |
y_range | A |
xlab | A |
ylab | A |
main | A |
mar | A |
add_axis_x | A |
add_axis_y | A |
col_box | A |
col_grid | A |
col_band | A |
col_title | A |
add_band | A |
title_band_width | A |
grid_lty | A |
Value
Added title, grid, and axes.
Author(s)
Stephane Guerrier and Justin Lee
Examples
make_frame(x_range = c(0, 1), y_range = c(0, 1), xlab = "my xlab", ylab = "my ylab", main = "my title") make_frame(x_range = c(0, 1), y_range = c(0, 1), xlab = "my xlab", ylab = "my ylab", add_band = FALSE) make_frame(x_range = c(0, 1), y_range = c(0, 1), xlab = "my xlab", ylab = "my ylab", main = "my title", col_band = "blue3", col_title = "white", col_grid = "lightblue", grid_lty = 3)make_frame(x_range = c(0, 1), y_range = c(0, 1), xlab = "my xlab", ylab = "my ylab", main = "my title", col_band = "blue3", col_title = "white", col_grid = "lightblue", grid_lty = 3, title_band_width = 0.18)mb16 filter construction
Description
Creates the mb16 filter
Usage
mb16_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
mb24 filter construction
Description
Creates the mb24 filter
Usage
mb24_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
mb4 filter construction
Description
Creates the mb4 filter
Usage
mb4_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
mb8 filter construction
Description
Creates the mb8 filter
Usage
mb8_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Mean of the First Difference of the Data
Description
The mean of the first difference of the data
Usage
mean_diff(x)Arguments
x | A |
Value
Adouble that contains the mean of the first difference of the data.
Obtain the smallest polynomial root
Description
Calculates all the roots of a polynomial and returns the root that is the smallest.
Usage
minroot(x)Arguments
x | A |
Value
Adouble with the minimum root value.
Generate the ts model object description
Description
Creates the ts.model's obj.desc value
Usage
model_objdesc(desc)Arguments
desc | A |
Details
This function currently does NOT support ARMA(P,Q) models. That is, there is no support for ARMA(P,Q), AR(P), or MA(Q).There is support for ARMA11, AR1, MA1, GM, WN, DR, QN, and RW.
Value
Afield<vec> that contains the object description of each process.
Generate the ts model object's process desc
Description
Creates the ts.model's process desc
Usage
model_process_desc(desc)Arguments
desc | A |
Details
This function currently does NOT support ARMA(P,Q) models. That is, there is no support for ARMA(P,Q), AR(P), or MA(Q).There is support for ARMA11, AR1, MA1, GM, WN, DR, QN, and RW.
Value
Avector<string> with a list of descriptive values to label the estimate matrix with
Model Score
Description
Calculates the modeling score of a GMWM
Usage
model_score(A, D, omega, v_hat, obj_value)Arguments
A | A |
omega | A |
v_hat | A |
Details
The equation is slightly different than that stated in the paper due to the bootstrap already incorporating in N.
Value
Avec
Generate the ts model object's theta vector
Description
Creates the ts.model's theta vector
Usage
model_theta(desc)Arguments
desc | A |
Details
This function currently does NOT support ARMA(P,Q) models. That is, there is no support for ARMA(P,Q), AR(P), or MA(Q).There is support for ARMA11, AR1, MA1, GM, WN, DR, QN, and RW.
Value
Avec with values initialized at 0 that span the space of parameters to be estimated.
Maximum Overlap Discrete Wavelet Transform
Description
Calculation of the coefficients for the discrete wavelet transformation
Usage
modwt_cpp(x, filter_name, nlevels, boundary, brickwall)Arguments
x | A |
filter_name | A |
nlevels | An |
boundary | A |
brickwall | A |
Details
Performs a level J decomposition of the time series using the pyramid algorithm.Use this implementation to supply custom parameters instead of modwt(x),which serves as a wrapper function.
Value
y Afield<vec> that contains the wavelet coefficients for each decomposition level
Author(s)
JJB
Computes the (MODWT) wavelet variance
Description
Calculates the (MODWT) wavelet variance
Usage
modwt_wvar_cpp( signal, nlevels, robust, eff, alpha, ci_type, strWavelet, decomp)Arguments
signal | A |
robust | A |
eff | A |
alpha | A |
ci_type | A |
strWavelet | A |
decomp | A |
Details
This function powers the wvar object. It is also extendable...
Value
Amat with the structure:
"variance" | Wavelet Variance |
"low" | Lower CI |
"high" | Upper CI |
Bootstrap standard error for the median
Description
Non-parametric bootstrap to obtain the standard of the median ofiid data.
Usage
np_boot_sd_med(x, B = 5000)Arguments
x | A |
B | A |
Value
Bootstrap standard error for the median
Replicate a Vector of Elementsn times
Description
This function takes a vector and replicates all of the datan times
Usage
num_rep(x, n)Arguments
x | A |
n | An |
Value
Avec with repeated elements of the initial supplied vector.
Extract Object
Description
Extracts the object information and returns it.
Usage
obj_extract(theta, objdesc, cur_position)Arguments
theta | A |
objdesc | A |
cur_position | An |
Value
Afield<vec> containing the breakdown of the object.
Bootstrap for Optimism and GoF
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters, obtain the wavelet variance, and then V.
Usage
opt_n_gof_bootstrapper( theta, desc, objdesc, scales, model_type, N, robust, eff, alpha, H)Arguments
theta | A |
desc | A |
objdesc | A |
scales | A |
model_type | A |
N | A |
robust | A |
eff | A |
H | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Bootstrap for Optimism
Description
Using the bootstrap approach, we simulate a model based on user supplied parameters, obtain the wavelet variance, and then V.
Usage
optimism_bootstrapper( theta, desc, objdesc, scales, model_type, N, robust, eff, alpha, H)Arguments
theta | A |
desc | A |
objdesc | A |
Details
Expand in detail...
Value
Avec that contains the parameter estimates from GMWM estimator.
Author(s)
JJB
Order the Model
Description
Orders the model and changes it to the correct format
Usage
orderModel(models)Arguments
models | A vector of |
Details
If themodels are c("AR1", "WN", "AR1", "WN", "AR1+WN+AR1+WN"), it will be converted to c("AR1-1", "WN-1", "AR1-2", "WN-2", "AR1+WN+AR1+WN").
This function is used ingen.lts()
Examples
models = c("AR1", "WN", "AR1", "WN", "AR1+WN+AR1+WN")new.models = orderModel(models)new.modelsmodels = c('AR1', 'QN', 'WN', 'AR1+QN+WN')new.models = orderModel(models)new.modelsOrder AR1s by size of phi.
Description
Changes the order of AR1s in a string by size.
Usage
order_AR1s(theta, desc, objdesc)Arguments
theta | A |
desc | A |
objdesc | A |
Value
Avec that has AR1s shown in descending parameter value.
Plot Partial Auto-Covariance and Correlation Functions
Description
The function plots the output of thetheo_pacf andauto_corr functions (partial autocovariance or autocorrelation functions).
Usage
## S3 method for class 'PACF'plot( x, xlab = NULL, ylab = NULL, show.ci = TRUE, alpha = NULL, col_ci = NULL, transparency = NULL, main = NULL, parValue = NULL, ...)Arguments
x | |
xlab | A |
ylab | A |
show.ci | A |
alpha | A |
col_ci | A |
transparency | A |
main | A |
parValue | A |
... | Additional parameters |
Author(s)
Yunxiang Zhang and Yuming Zhang
Examples
# Plot the Partial Autocorrelationm = auto_corr(datasets::AirPassengers, pacf = TRUE)plot(m)# More customized CIplot(m, xlab = "my xlab", ylab = "my ylab", show.ci = TRUE, alpha = NULL, col_ci = "grey", transparency = 0.5, main = "my main")Plot the GMWM with the Wavelet Variance
Description
Displays a plot of the Wavelet Variance (WV) with the CI values and the WV implied by the estimated parameters.
Usage
## S3 method for class 'gmwm'plot( x, decomp = FALSE, units = NULL, xlab = NULL, ylab = NULL, main = NULL, col_wv = NULL, col_ci = NULL, nb_ticks_x = NULL, nb_ticks_y = NULL, legend_position = NULL, ci_wv = NULL, point_cex = NULL, point_pch = NULL, ...)Arguments
x | A |
decomp | A |
units | A |
xlab | A |
ylab | A |
main | A |
col_wv | A |
col_ci | A |
nb_ticks_x | An |
nb_ticks_y | An |
legend_position | A |
ci_wv | A |
point_cex | A |
point_pch | A |
... | Additional arguments affecting the plot. |
Value
Plot of WV and relative confidence intervals for each scale.
Author(s)
Stephane Guerrier and Yuming Zhang
Plot simts Time Series Data
Description
Plot simts Time Series Data generated by gts or gen_gts.
Usage
## S3 method for class 'gts'plot( x, evenly = TRUE, xlab = NULL, ylab = NULL, main = NULL, couleur = "blue4", ...)Arguments
x | A |
evenly | A |
xlab | A |
ylab | A |
main | A |
couleur | A |
... | additional arguments affecting the plot produced. |
Value
A plot containing the graph of the simts time series.
Author(s)
Justin Lee and Stéphane Guerrier
Plot Latent Time Series Object
Description
Plot Latent Time Series Data included in anlts object.
Usage
## S3 method for class 'lts'plot( x, xlab = NULL, ylab = NULL, main = NULL, color = NULL, fixed_range = FALSE, ...)Arguments
x | A |
xlab | A |
ylab | A |
main | A |
color | A |
... | additional arguments affecting the plot produced. |
Value
A plot containing the graph of the latent time series.
Author(s)
Stephane Gurrier and Justin Lee
Plot Auto-Covariance and Correlation Functions
Description
The function plots the output of thetheo_acf andauto_corr functions (autocovariance or autocorrelation functions).
Usage
## S3 method for class 'simtsACF'plot( x, xlab = NULL, ylab = NULL, show.ci = TRUE, alpha = NULL, col_ci = NULL, transparency = NULL, main = NULL, parValue = NULL, ...)Arguments
x | An |
xlab | A |
ylab | A |
show.ci | A |
alpha | A |
col_ci | A |
transparency | A |
main | A |
parValue | A |
... | Additional parameters |
Author(s)
Yunxiang Zhang, Stéphane Guerrier and Yuming Zhang
Examples
# Calculate the Autocorrelationm = auto_corr(datasets::AirPassengers)# Plot with 95% CIplot(m) # Plot with 90% CIplot(m, alpha = 0.1) # Plot without 95% CIplot(m, show.ci = FALSE)# More customized CIplot(m, xlab = "my xlab", ylab = "my ylab", show.ci = TRUE,alpha = NULL, col_ci = "grey", transparency = 0.5, main = "my main")Plot Time Series Forecast Function
Description
This function plots the time series output from a forecast method with approximate 68
Usage
plot_pred( x, model, n.ahead, level = NULL, xlab = NULL, ylab = NULL, main = NULL, ...)Arguments
x | A |
model | A |
n.ahead | An |
level | A |
xlab | A |
ylab | A |
main | A |
... | Additional parameters |
Author(s)
Yuming Zhang
Time Series Prediction
Description
This function plots the time series forecast.
Usage
## S3 method for class 'fitsimts'predict( object, n.ahead = 10, show_last = 100, level = NULL, xlab = NULL, ylab = NULL, main = NULL, plot = TRUE, ...)Arguments
object | A |
n.ahead | An |
show_last | A |
level | A |
xlab | A |
ylab | A |
main | A |
plot | A |
... | Additional arguments. |
Author(s)
Stéphane Guerrier and Yuming Zhang
Examples
Xt = gen_gts(300, AR(phi = c(0, 0, 0.8), sigma2 = 1))model = estimate(AR(3), Xt)predict(model)predict(model, level = 0.95)x = gts(as.vector(lynx), start = 1821, end = 1934, freq = 1, unit_ts = bquote(paste(10^8," ",m^3)), name_ts = "Numbers", unit_time = "year", data_name = "Annual Numbers of Lynx Trappings")model = estimate(AR(1), x)predict(model, n.ahead = 20)predict(model, n.ahead = 20, level = 0.95)predict(model, n.ahead = 20, level = c(0.50, 0.80, 0.95))Predict future points in the time series using the solution of theGeneralized Method of Wavelet Moments
Description
Creates a prediction using the estimated values of GMWM through theARIMA function within R.
Usage
## S3 method for class 'gmwm'predict(object, data.in.gmwm, n.ahead = 1, ...)Arguments
object | A |
data.in.gmwm | The data SAME EXACT DATA used in the GMWM estimation |
n.ahead | Number of observations to forecast |
... | Additional parameters passed to ARIMA Predict |
Value
Apredict.gmwm object with:
pred | Predictions |
se | Standard Errors |
resid | Residuals from ARIMA ML Fit |
Print fitsimts object
Description
This function displays the information of a fitsimts object.
Usage
## S3 method for class 'fitsimts'print(x, ...)Arguments
x | A |
... | Other arguments passed to specific methods |
Value
Text output via print
Author(s)
Stéphane Guerrier and Yuming Zhang
Print gmwm object
Description
Displays information about GMWM object
Usage
## S3 method for class 'gmwm'print(x, ...)Arguments
x | A |
... | Other arguments passed to specific methods |
Value
Text output via print
Author(s)
JJB
Print simts Objects
Description
Pretty formatting forgts,imu, andlts objects.
Usage
## S3 method for class 'imu'print(x, obs = 10L, row.names = TRUE, ...)## S3 method for class 'lts'print(x, obs = 10L, row.names = TRUE, ...)## S3 method for class 'gts'print(x, obs = 10L, row.names = TRUE, ...)outf(x, obs = 10L, row.names = TRUE)Arguments
x | A |
obs | A |
row.names | A |
... | Further arguments passed to or from other methods. |
Value
Alogical value that indicates whether the object is of that class (TRUE) or not (FALSE).
Author(s)
James Balamuta
Print summary.gmwm object
Description
Displays summary information about GMWM object
Usage
## S3 method for class 'summary.gmwm'print(x, ...)Arguments
x | A |
... | Other arguments passed to specific methods |
Value
Text output via print
Author(s)
JJB
Multiply a ts.model by constant
Description
Sets up the necessary backend for creating multiple model objects.
Usage
## S3 method for class 'ts.model'print(x, ...)Arguments
x | A |
... | further arguments passed to or from other methods. |
Value
An S3 object with called ts.model with the following structure:
desc
theta
Author(s)
James Balamuta
Examples
# Creates a parameter space for guessingQN() + DR() + WN() + RW() + AR1() + ARMA(1,2)# Creates a user-specified starting value modelAR1(phi = .9, sigma2 = .1) + WN(sigma2 = 1) # Similarly, with the addition of a generic ARMARW(gamma2 = .3) + DR(omega = .5) + QN(q2 = .9) + ARMA(ar = c(.3,.1), ma = c(.3,.2), sigma2 = .99)# In a similar vein, this example highlights the lack of need for specifying parameters. AR1(.9,.1) + WN(1) + RW(.3) + DR(.5) + QN(.9) + ARMA(c(.3,.1), c(.3,.2), .99)Pseudo Logit Function
Description
This function compute the link function to constrain parameters to a positive domain.
Usage
pseudo_logit(x)Arguments
x | A |
Value
Avec containing logit terms.
Author(s)
James Joseph Balamuta (JJB)
Pseudo Logit Inverse Function
Description
This function computes the pseudo inverse of a logit transformation of the parameters in order to constrain them to a positive domain
Usage
pseudo_logit_inv(x)Arguments
x | A |
Value
Avec containing logit probabilities.
Author(s)
James Joseph Balamuta (JJB)
Quadrature Mirror Filter
Description
Calculate the series quadrature mirror filter (QMF). Requires a series of an even length.
Usage
qmf(g, inverse)Arguments
g | A |
inverse | A |
Value
Avector that contains either the forward QMF (evalute in order) or the inverse QMF (reverse order).
Author(s)
JJB
Quantisation Noise (QN) to WV
Description
This function compute the Haar WV of a Quantisation Noise (QN) process
Usage
qn_to_wv(q2, tau)Arguments
q2 | A |
tau | A |
Value
Avec containing the wavelet variance of the QN.
Process Haar Wavelet Variance Formula
The Quantization Noise (QN) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {{Q^2}} \right) = \frac{{6{Q^2}}}{{\tau _j^2}}
Find Quantiles
Description
Attempts to find quantiles
Usage
quantile_cpp(x, probs)Arguments
x | A |
probs | A |
Value
Avector containing the quantiles
Author(s)
James J Balamuta
Find the Rank Models result
Description
Provides the core material to create an S3 object for rank.models
Usage
rank_models_cpp( data, model_str, full_model, alpha, compute_v, model_type, K, H, G, robust, eff, bs_optimism, seed)Arguments
data | A |
model_str | A |
full_model | A |
alpha | A |
compute_v | A |
model_type | A |
K | A |
H | A |
G | A |
robust | A |
eff | A |
bs_optimism | A |
seed | A |
Value
Afield<field<field<mat>>> that contains the model score matrix and the best GMWM model object.
Read an IMU Binary File into R
Description
Process binary files within the
Usage
read.imu(file, type, unit = NULL, name = NULL)Arguments
file | A |
type | A |
unit | A |
name | A |
Details
Currently supports the following IMUs:
IMAR
LN200
LN200IG
IXSEA
NAVCHIP_INT
NAVCHIP_FLT
Value
Animu object that contains 3 gyroscopes and 3 accelerometers in that order.
Author(s)
James BalamutaWe hope to soon be able to support delimited files.
References
Thanks goes to Philipp Clausen of Labo TOPO, EPFL, Switzerland, topo.epfl.ch, Tel:+41(0)21 693 27 55for providing a matlab function that reads in IMUs.This function is a heavily modified port of MATLAB code into Armadillo/C++.
Examples
## Not run: # Relativesetwd("F:/")a = read.imu(file = "Documents/James/short_test_data.imu", type = "IXSEA")# Fixed pathb = read.imu(file = "F:/Desktop/short_test_data.imu", type = "IXSEA")## End(Not run)Read an IMU Binary File into R
Description
The function will take a file location in addition to the type of sensor itcame from and read the data into R.
Usage
read_imu(file_path, imu_type)Arguments
file_path | A |
imu_type | A |
Details
Currently supports the following IMUs:
IMAR
LN200
LN200IG
IXSEA
NAVCHIP_INT
NAVCHIP_FLT
We hope to soon be able to support delimited files.
Value
A matrix with dimensions N x 7, where the columns represent:
- Col 0
Time
- Col 1
Gyro 1
- Col 2
Gyro 2
- Col 3
Gyro 3
- Col 4
Accel 1
- Col 5
Accel 2
- Col 6
Accel 3
References
Thanks goes to Philipp Clausen of Labo TOPO, EPFL, Switzerland, topo.epfl.ch, Tel:+41(0)21 693 27 55for providing a matlab function that reads in IMUs.The function below is a heavily modified port of MATLAB code into Armadillo/C++.
Plot the Distribution of (Standardized) Residuals
Description
This function plots a histogram (with kernel density function and normal distribution) of the standardizedresiduals or a basic plot the (standardized) residuals, or both.
Usage
resid_plot(res, std = FALSE, type = "hist", ...)Arguments
res | A |
std | A |
type | A |
... | Additional parameters |
Author(s)
Yuming Zhang
Reverse Subset Column
Description
Subsets the column by going from high indices to low (the reverse of the supported practice)
Usage
rev_col_subset(x, start, end)Arguments
x | A |
start | A |
end | A |
Details
Consider a vector x=[[1,2],[3,4]].By settingstart=1 andend=0, the function would output x=[[2,1],[4,1]].Start and end must be valid C++ matrix locations. (e.g. matrix cols start at 0 and not 1)
Value
x Amatrix with matrix rows displayed in reverse order
Author(s)
JJB
Reverse Subset Row
Description
Subsets the row by going from high indices to low (the reverse of the supported practice)
Usage
rev_row_subset(x, start, end)Arguments
x | A |
start | A |
end | A |
Details
Consider a vector x=[[1,2],[3,4]], the function would output x=[[3,4],[1,2]].Start and end must be valid C++ matrix locations. (e.g. matrix rows start at 0 and not 1)
Value
x Amatrix with matrix rows displayed in reversed order
Author(s)
JJB
Reverse Armadillo Vector
Description
Reverses the order of an Armadillo Vector
Usage
reverse_vec(x)Arguments
x | A |
Details
Consider a vector x=[1,2,3,4,5], the function would output x=[5,4,3,2,1].
Value
x Acolumn vector with its contents reversed.
Author(s)
JJB
Time Series Recursive Filters
Description
Applies a recursive filter to a univariate time series.
Usage
rfilter(x, filter, init)Arguments
x | A |
filter | A |
init | A |
Details
Note: The length of 'init' must be equal to the length of 'filter'.This is a port of the rfilter function harnessed by the filter function in stats. It is about 6-7 times faster than R's base function. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.
Value
x Acolumn vector with its contents reversed.
Author(s)
JJB
GMWM for Robust/Classical Comparison
Description
Creates argmwm object to compare the results generated by robust/classical method.
Usage
rgmwm(model, data, eff = c(0.9, 0.8, 0.6), ...)Arguments
model | A |
data | A |
eff | A |
... | Other arguments passed to the main |
Details
By default, thergmwm function will fit a classicalgmwmobject. From there, the user has the ability to specify anyeff that isless than or equal to 0.99.
Value
Argmwm object
Truncated Normal Distribution Sampling Algorithm
Description
Enables sampling from a truncated normal
Usage
rtruncated_normal(n, mu, sigma, a, b)Arguments
n | An |
mu | A |
sigma | A |
a | A |
b | A |
Random Walk to WV
Description
This function compute the WV (haar) of a Random Walk process
Usage
rw_to_wv(gamma2, tau)Arguments
gamma2 | A |
tau | A |
Value
Avec containing the wavelet variance of the random walk.
Process Haar Wavelet Variance Formula
The Random Walk (RW) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {{\gamma ^2}} \right) = \frac{{\left( {\tau _j^2 + 2} \right){\gamma ^2}}}{{12{\tau _j}}}
Calculates Length of Seasonal Padding
Description
Computes the total phi and total theta vector length.
Usage
sarma_calculate_spadding(np, nq, nsp, nsq, ns)Arguments
np | An |
nq | An |
nsp | An |
nsq | An |
Value
Avec with rows:
- p
Number of phi parameters
- q
Number of theta parameters
Determine parameter expansion based upon objdesc
Description
Calculates the necessary vec space needed to pad the vectorsfor seasonal terms.
Usage
sarma_components(objdesc)Arguments
objdesc | A |
Value
Avec with the structure:
- np
Number of Non-Seasonal AR Terms
- nq
Number of Non-Seasonal MA Terms
- nsp
Number of Seasonal AR Terms
- nsq
Number of Seasonal MA Terms
- ns
Number of Seasons (e.g. 12 is year)
- p
Total number of phi terms
- q
Total number of theta terms
Expand Parameters for an SARMA object
Description
Creates an expanded PHI and THETA vector for use in other objects.
Usage
sarma_expand(params, objdesc)Arguments
params | A |
objdesc | A |
Details
Theobjdesc is assumed to have the structure of:
AR(p)
MA(q)
SAR(P)
SMA(Q)
Seasons
Value
Afield<vec> of size two as follows:
AR values
THETA values
(Internal) Expand the SARMA Parameters
Description
(Internal) Expand the SARMA Parameters
Usage
sarma_expand_unguided(params, np, nq, nsp, nsq, ns, p, q)Arguments
params | A |
np | An |
nq | An |
nsp | An |
nsq | An |
p | An |
q | An |
Value
Afield<vec> that contains the expansion.
Efficient way to merge items together
Description
Efficient way to merge items together
Usage
sarma_params_construct(ar, ma, sar, sma)Personal Saving Rate
Description
Personal saving as a percentage of disposable personalincome (DPI), frequently referred to as "the personal saving rate,"is calculated as the ratio of personal saving to DPI.
Usage
savingrtFormat
A gts time series object with frequency 12 starting at 1959 and goingto 2016 for a total of 691 observations.
Source
https://fred.stlouisfed.org/series/PSAVERT
Computes the MODWT scales
Description
Calculates the MODWT scales
Usage
scales_cpp(nb_level)Arguments
nb_level | A |
Details
Used in wvar object.
Value
Avec that contains 2^1, ... , 2^J
Time Series Model Selection
Description
This function performs model fitting and calculates the model selection criteria to be plotted.
Usage
select(model, Xt, include.mean = TRUE, criterion = "aic", plot = TRUE)Arguments
model | A time series model (only ARIMA are currently supported). |
Xt | A |
include.mean | A |
criterion | A |
plot | A |
Author(s)
Stéphane Guerrier and Yuming Zhang
Examples
set.seed(763)Xt = gen_gts(100, AR(phi = c(0.2, -0.5, 0.4), sigma2 = 1))select(AR(5), Xt, include.mean = FALSE)Xt = gen_gts(100, MA(theta = c(0.2, -0.5, 0.4), sigma2 = 1))select(MA(5), Xt, include.mean = FALSE)Xt = gen_gts(500, ARMA(ar = 0.5, ma = c(0.5, -0.5, 0.4), sigma2 = 1))select(ARMA(5,3), Xt, criterion = "hq", include.mean = FALSE)Run Model Selection Criteria on ARIMA Models
Description
This function performs model fitting and calculates the model selection criteria to be plotted or used inbest_model function.
Usage
select_arima( xt, p.min = 0L, p.max = 3L, d = 0L, q.min = 0L, q.max = 3L, include.mean = TRUE, plot = TRUE)select_arma( xt, p.min = 0L, p.max = 3L, q.min = 0L, q.max = 3L, include.mean = TRUE, plot = TRUE)select_ar(xt, p.min = 0L, p.max = 3L, include.mean = TRUE, plot = TRUE)select_ma(xt, q.min = 0L, q.max = 3L, include.mean = TRUE, plot = TRUE)Arguments
xt | A |
p.min | An |
p.max | An |
d | An |
q.min | An |
q.max | An |
include.mean | A |
plot | A |
Examples
xt = gen_arima(N=100, ar=0.3, d=1, ma=0.3)x = select_arima(xt, d=1L)xt = gen_ma1(100, 0.3, 1)x = select_ma(xt, q.min=2L, q.max=5L)best_model(x)xt = gen_arma(10, c(.4,.5), c(.1), 1, 0) x = select_arma(xt, p.min = 1L, p.max = 4L, q.min = 1L, q.max = 3L)Select the Wavelet Filter
Description
Constructs the wavelet filter to be used.
Usage
select_filter(filter_name)Arguments
filter_name | A |
Details
The package is oriented toward using only the haar filter. If the package extends at a later time, then the supporting infrastructure is there.
Value
info Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Generate a sequence of values
Description
Creates a vector containing a sequence of values starting at the initial point and going to the terminal point.
Usage
seq_cpp(a, b)Arguments
a | An |
b | An |
Value
Avector containing values moving from a to b. There are no restrictions on A's range.
Author(s)
James J Balamuta
Generate a sequence of values based on supplied number
Description
Creates a vector containing a sequence of values starting at 1 and going to the terminal point.
Usage
seq_len_cpp(n)Arguments
n | An |
Value
Avector containing values moving from 1 to n.
Author(s)
James J Balamuta
Set the RNG Seed from within Rcpp
Description
Within Rcpp, one can set the R session seed without triggeringthe CRAN rng modifier check.
Usage
set_seed(seed)Arguments
seed | A |
Value
A set RNG scope.
Basic Diagnostic Plot of Residuals
Description
This function will plot four diagnostic plots to assess how well the model fits the data. These plots are: (1) residuals plot, (2) histogram of (standardized) residuals, (3) normal Q-Q plot of residuals and (4) residuals vs fitted values plot.
Usage
simple_diag_plot(Xt, model, std = FALSE)Arguments
Xt | The original time series data. |
model | The |
std | A |
Author(s)
Yuming Zhang
Simplify and print SARIMA model
Description
Simplify and print SARIMA model
Usage
simplified_print_SARIMA(p, i, q, P, si, Q, s)Arguments
p | An |
i | An |
q | An |
P | An |
si | An |
Q | An |
s | An |
Value
An S3 object with the following structure:
String containing simplified model
- simplified
Type of model (after simplification)
Author(s)
Stephane Guerrier
Sort Matrix by Column
Description
Sorts a given matrix by a specific column while retain the elements in each row.
Usage
sort_mat(x, col)Arguments
x | A |
col | A |
Details
The functional difference between armadillo's sort() and sort_mat() is straight forward.sort() will sort each column without respect to the rows. Using sort_matrix will sort only 1 column and retain the other elements to be in the same row.
Value
The matrix sorted by values in the specified column.
Accumulation of Armadillo field<vec>
Description
Sums vectors in a field into a single variable.
Usage
sum_field_vec(x)Arguments
x | A |
Value
Anmat containing the field elements within a column.
Author(s)
JJB
Summary of fitsimts object
Description
Displays summary information about fitsimts object
Usage
## S3 method for class 'fitsimts'summary(object, ...)Arguments
object | A |
... | Other arguments passed to specific methods |
Value
Estimated parameters values with confidence intervals and standard errors.
Author(s)
Stéphane Guerrier
Summary of GMWM object
Description
Displays summary information about GMWM object
Usage
## S3 method for class 'gmwm'summary( object, inference = NULL, bs.gof = NULL, bs.gof.p.ci = NULL, bs.theta.est = NULL, bs.ci = NULL, B = 100, ...)Arguments
object | A |
inference | A value containing either: NULL (auto), TRUE, or FALSE |
bs.gof | A value containing either: NULL (auto), TRUE, FALSE |
bs.gof.p.ci | A value containing either: NULL (auto), TRUE, FALSE |
bs.theta.est | A value containing either: NULL (auto), TRUE, FALSE |
bs.ci | A value containing either: NULL (auto), TRUE, FALSE |
B | An |
... | Other arguments passed to specific methods |
Value
Asummary.gmwm object with:
estimate | Estimated Theta Values |
testinfo | Goodness of Fit Information |
inference | Inference performed? T/F |
bs.gof | Bootstrap GOF? T/F |
bs.gof.p.ci | Bootstrap GOF P-Value CI? T/F |
bs.theta.est | Bootstrap Theta Estimates? T/F |
bs.ci | Bootstrap CI? T/F |
starting | Indicates if program supplied initial starting values |
seed | Seed used during guessing / bootstrapping |
obj.fun | Value of obj.fun at minimized theta |
N | Length of Time Series |
Author(s)
JJB
Theoretical Autocorrelation (ACF) of an ARMA process
Description
This function computes the theoretical Autocorrelation (ACF) of an ARMA process.
Usage
theo_acf(ar, ma = NULL, lagmax = 20)Arguments
ar | A |
ma | A |
lagmax | An |
Author(s)
Yuming Zhang
Examples
# Compute the theoretical ACF for an ARMA(1,0) (i.e. a first-order autoregressive model: AR(1))theo_acf(ar = -0.25, ma = NULL)# Computes the theoretical ACF for an ARMA(2, 1)theo_acf(ar = c(.50, -0.25), ma = 0.20, lagmax = 10)Theoretical Partial Autocorrelation (PACF) of an ARMA process
Description
This function computes the theoretical Partial Autocorrelation (PACF) of an ARMA process.
Usage
theo_pacf(ar, ma = NULL, lagmax = 20)Arguments
ar | A |
ma | A |
lagmax | An |
Author(s)
Yuming Zhang
Examples
# Computes the theoretical ACF for an ARMA(1,0) (i.e. a first-order autoregressive model: AR(1))theo_pacf(ar = -0.25, ma = NULL, lagmax = 7)# Computes the theoretical ACF for an ARMA(2, 1)theo_pacf(ar = c(.50, -0.25), ma = .20, lagmax = 10)Model Process to WV
Description
This function computes the summation of all Processes to WV (haar) in a given model
Usage
theoretical_wv(theta, desc, objdesc, tau)Arguments
theta | A |
desc | A |
objdesc | A |
tau | A |
Value
Avec containing the wavelet variance of the model.
Generate the Confidence Interval for Theta Estimates
Description
Create an Asymptotic CI for the Theta Estimates.
Usage
theta_ci(theta, A, v_hat, omega, alpha)Arguments
theta | A |
A | A |
v_hat | A |
omega | A |
alpha | A |
Value
Amat that has the first column
Transform Values for Optimization
Description
Transform parameter guesses prior to estimating with GMWM
Usage
transform_values(theta, desc, objdesc, model_type)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
Value
Avec containing the transformed guesses.
Author(s)
James Joseph Balamuta (JJB)
Convert Unit of Time Series Data
Description
Manipulate the units of time to different ones
Usage
unitConversion(x, from.unit, to.unit)Arguments
x | A |
from.unit | A |
to.unit | A |
Details
The supported units are "ns"(nanosecond), "ms"(millisecond), "sec", "min", "hour", "day", "month", and "year".Make surefrom.unit andto.unit are notNULL before it is passed to this function.
Value
Alist with the following structure:
- x
Data
- converted
A
booleanindicating whether conversion is made
Examples
x = seq(60, 3600, 60)unitConversion(x, 'sec', 'min')y = 1:10unitConversion(y, 'hour', 'sec')Revert Transform Values for Display
Description
Undo the previous transform of parameter guesses to obtain the GMWM estimates.
Usage
untransform_values(theta, desc, objdesc, model_type)Arguments
theta | A |
desc | A |
objdesc | A |
model_type | A |
Value
Avec containing the undone transformation of parameters.
Author(s)
James Joseph Balamuta (JJB)
Update (Robust) GMWM object for IMU or SSM
Description
Provides a way to estimate different models over the previously estimatedwavelet variance values and covariance matrix.
Usage
## S3 method for class 'gmwm'update(object, model, ...)Arguments
object | A |
model | A |
... | Additional parameters (not used) |
Value
Agmwm 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 |
|
model.hat | A new value of |
starting | Indicates whether the procedure used the initial guessing approach |
seed | Randomization seed used to generate the guessing values |
freq | Frequency of data |
Update Object Attribute
Description
Update the attributes oflts,gts andimu object
Usage
## S3 method for class 'lts'update(object, type, new, keep.start = T, ...)## S3 method for class 'gts'update(object, type, new, keep.start = T, ...)## S3 method for class 'imu'update(object, type, new, ...)Arguments
object | A |
type | A |
new | The updated value for the attribute |
keep.start | A |
... | Further arguments passed to or from other methods. |
Details
This function is able to update some attributes forgts,lts andimu objects. Forlts object, the attributes that can be updated are 'start', 'end', 'freq', 'unit_time', 'name_ts' and 'process'.Forgts object, the attributes that can be updated are 'start', 'end', 'freq', 'unit_time' and 'name_ts'.Forimu object, the attributes that can be updated are 'axis', 'freq', 'unit_time' and 'name_ts'.
If one between 'start' and 'end' is updated, the other one will also be updated, sinceend-start == (N-1)/freq must be TRUE, whereNis the number of observations in the object.
If 'freq' is updated, by default 'start' will remain the same, and 'end' will be updated at the same time,unless you set 'keep.start = F'.
If 'unit_time' is updated, the old unit_time will be replaced by the new one, and other attributes will remain the same.It is different from the unit_time conversion feature.
Value
An object with the updated attribute.
Examples
gts1 = gts(rnorm(50), freq = 1, unit_time = 'sec', name_ts = 'test1')gts2 = update(gts1, 'unit_time', 'min')attr(gts2, 'unit_time')gts3 = update(gts1, 'name_ts', 'test2')attr(gts3, 'name_ts')Update the Attributes of Objects
Description
Internal Function to Update the Attributes of Objects
Usage
update_obj(object, type, new, keep.start = T)Arguments
object | A |
type | A |
new | The updated value for the attribute |
keep.start | A |
Value
An object with the updated attribute.
Obtain the value of an object's properties
Description
Used to access different properties of thegts,imu, orlts object.
Usage
value(x, type)## S3 method for class 'imu'value(x, type)Arguments
x | A |
type | A |
Details
To access information aboutimu properties use:
"accel"Returns the number of accelerometers
"gyro"Returns the number of gyroscopes
"sensors"Returns total number of sensors
Value
The method will return a single numeric or string result depending on theslot being accessed.
Methods (by class)
value(imu): Accessimuobject properties
Author(s)
James Balamuta
Variance DR
Description
This function computes the variance of a drift process.
Usage
var_drift(omega, n_ts)Arguments
omega | A |
n_ts | An |
Value
Avec containing the variance of the drift.
Conversion function of Vector to Set
Description
Converts a vector into a set
Usage
vector_to_set(model_str)Value
Aset<vector<string>> that contains the list of unique models.
w4 filter construction
Description
Creates the w4 filter
Usage
w4_filter()Details
This template can be used to increase the amount of filters available for selection.
Value
Afield<vec> that contains:
"L" | A |
"h" | A |
"g" | A |
Author(s)
JJB
Generate a Wave Variance for a Univariate Time Series
Description
Computes an estimate of the wave variance
Usage
wave_variance(signal_modwt_bw, robust = FALSE, eff = 0.6)Arguments
signal_modwt_bw | A |
robust | A |
eff | A |
Value
Avec that contains the wave variance.
Gaussian White Noise to WV
Description
This function compute the Haar WV of a Gaussian White Noise process
Usage
wn_to_wv(sigma2, tau)Arguments
sigma2 | A |
tau | A |
Value
Avec containing the wavelet variance of the white noise.
Process Haar Wavelet Variance Formula
The Gaussian White Noise (WN) process has a Haar Wavelet Variance given by:
\nu _j^2\left( {{\sigma ^2}} \right) = \frac{{{\sigma ^2}}}{{\tau _j^2}}
Computes the (MODWT) wavelet variance
Description
Calculates the (MODWT) wavelet variance
Usage
wvar_cpp(signal_modwt_bw, robust, eff, alpha, ci_type)Arguments
signal_modwt_bw | A |
robust | A |
eff | A |
alpha | A |
ci_type | A |
Details
This function does the heavy lifting with the signal_modwt_bw
Value
Amat with the structure:
"variance" | Wavelet Variance |
"low" | Lower CI |
"high" | Upper CI |