Learn R Programming

simts Overview

The Time Series Tools (simts) R package provides a series of tools to simulate, plot, estimate, select and forecast different time series models. Its original purpose was to be a support to the online textbook “Applied Time Series Analysis with R” but can obviously be used for time series analysis in general. More specifically, the package provides tools with the following features:

  • Simulation of time series from SARIMA models to various state-space models that can be expressed as latent time series processes.
  • Visualization of time series data with user specifications.
  • Specific simulation and visualization tools for latent time series models.
  • Easy-to-use functions to estimate and infer on the parameters of time series models through different methods (standard and robust).
  • Diagnostic and statistical tools to assess goodness of fit and select the best model for the data.
  • Estimating and plotting tools to deliver point forecasts and confidence intervals.

To understand the usage of the simts package, please refer to the “Vignettes” tab above.

Install Instructions

Installation

The simts package is available on both CRAN and GitHub. The CRAN version is considered stable while the GitHub version is subject to modifications/updates which may lead to installation problems or broken functions. You can install the stable version of the simts package with:

install.packages("simts")

For users who are interested in having the latest developments, the GitHub version is ideal although more dependencies are required to run a stable version of the package. Most importantly, users must have a (C++) compiler installed on their machine that is compatible with R (e.g. Clang).

# Install dependencies
install.packages(c("RcppArmadillo","devtools","knitr","rmarkdown"))

# Install the package from GitHub without Vignettes/User Guides
devtools::install_github("SMAC-Group/simts")

# Install the package with Vignettes/User Guides 
devtools::install_github("SMAC-Group/simts", build_vignettes = TRUE)

The setup to obtain the development version of simts is platform dependent.

License

The license this source code is released under is the GNU AFFERO GENERAL PUBLIC LICENSE (AGPL) v3.0. Please see the LICENSE file for full text. Otherwise, please consult TLDR Legal or GNU which will provide a synopsis of the restrictions placed upon the code.

Copy Link

Version

Install

install.packages('simts')

Monthly Downloads

406

Version

0.2.2

License

AGPL-3 | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

St<c3><a9>phane Guerrier

Last Published

August 31st, 2023

Functions in simts (0.2.2)

ARMA11

Definition of an ARMA(1,1)
AR

Create an Autoregressive P [AR(P)] Process
AIC.fitsimts

Akaike's Information Criterion
AR1

Definition of an Autoregressive Process of Order 1
ARIMA

Create an Autoregressive Integrated Moving Average (ARIMA) Process
ARMAtoMA_cpp

Converting an ARMA Process to an Infinite MA Process
DR

Create an Drift (DR) Process
ARMA

Create an Autoregressive Moving Average (ARMA) Process
ARMAacf_cpp

Compute Theoretical ACF for an ARMA Process
B_matrix

B Matrix
FGN

Definition of a Fractional Gaussian Noise (FGN) Process
D_matrix

Analytic D matrix of Processes
GM

Create a Gauss-Markov (GM) Process
MA

Create an Moving Average Q [MA(Q)] Process
M

Definition of a Mean deterministic vector returned by the matrix by vector product of matrix \(X\) and vector \(\beta\)
MA1

Definition of an Moving Average Process of Order 1
MAPE

Median Absolute Prediction Error
MAT

Definition of a Matérn Process
Ma_cpp

Ma function.
Ma_cpp_vec

Ma vectorized function.
QN

Create an Quantisation Noise (QN) Process
RW2dimension

Function to Compute Direction Random Walk Moves
SARMA

Create a Seasonal Autoregressive Moving Average (SARMA) Process
SARIMA

Create a Seasonal Autoregressive Integrated Moving Average (SARIMA) Process
RW

Create an Random Walk (RW) Process
arma_adapter

ARMA Adapter to ARMA to WV Process function
PLP

Definition of a Power Law Process
arma_to_wv

ARMA process to WV
Mod_cpp

Absolute Value or Modulus of a Complex Number.
arma_draws

Randomly guess starting parameters for ARMA
arma_to_wv_app

ARMA process to WV Approximation
WN

Create an White Noise (WN) Process
ar1_draw

Randomly guess starting parameters for AR1
best_model

Select the Best Model
SIN

Definition of a Sinusoidal (SIN) Process
acf_sum

Helper Function for ARMA to WV Approximation
bl20_filter

bl20 filter construction
auto_corr

Empirical ACF and PACF
all_bootstrapper

Bootstrap for Everything!
Rcpp_ARIMA

Hook into R's ARIMA function
boot_pval_gof

Generate the Confidence Interval for GOF Bootstrapped
auto_imu_cpp

Find the auto imu result
ar1_to_gm

Transform AR1 to GM
australia

Quarterly Increase in Stocks Non-Farm Total, Australia
code_zero

Optim loses NaN
bl14_filter

bl14 filter construction
ci_wave_variance

Generate a Confidence intervval for a Univariate Time Series
corr_analysis

Correlation Analysis Functions
count_models

Count Models
compute_cov_cpp

Computes the (MODWT) wavelet covariance matrix
batch_modwt_wvar_cpp

Computes the MO/DWT wavelet variance for multiple processes
ci_eta3

Generate eta3 confidence interval
cov_bootstrapper

Bootstrap for Matrix V
ci_eta3_robust

Generate eta3 robust confidence interval
deriv_ar1

Analytic D matrix for AR(1) process
check

Diagnostics on Fitted Time Series Model
d16_filter

d16 filter construction
d4_filter

d4 filter construction
build_model_set

Build List of Unique Models
d8_filter

d8 filter construction
cfilter

Time Series Convolution Filters
d6_filter

d6 filter construction
calculate_psi_matrix

Calculate the Psi matrix
deriv_2nd_dr

Analytic second derivative matrix for drift process
deriv_2nd_arma11

Analytic D matrix for ARMA(1,1) process
deriv_2nd_ma1

Analytic second derivative for MA(1) process
deriv_2nd_ar1

Analytic second derivative matrix for AR(1) process
deriv_qn

Analytic D matrix for Quantization Noise (QN) Process
deriv_rw

Analytic D matrix Random Walk (RW) Process
decomp_theoretical_wv

Each Models Process Decomposed to WV
decomp_to_theo_wv

Decomposed WV to Single WV
deriv_arma11

Analytic D matrix for ARMA(1,1) process
estimate

Fit a Time Series Model to Data
desc.to.ts.model

Create a ts.model from desc string
ar1_to_wv

AR(1) process to WV
diag_plot

Diagnostic Plot of Residuals
arma11_to_wv

ARMA(1,1) to WV
dwt_cpp

Discrete Wavelet Transform
dft_acf

Discrete Fourier Transformation for Autocovariance Function
diag_portmanteau_

Portmanteau Tests
gen_gts

Simulate a simts TS object using a theoretical model
gen_lts

Generate a Latent Time Series Object Based on a Model
format_ci

Format the Confidence Interval for Estimates
do_polyroot_cpp

Root Finding C++
e_drift

Expected value DR
field_to_matrix

Transform an Armadillo field<vec> to a matrix
do_polyroot_arma

Root Finding C++
fast_cov_cpp

Computes the (MODWT) wavelet covariance matrix using Chi-square confidence interval bounds
gen_fgn

Generate a Fractional Gaussian noise given \(\sigma^2\) and \(H\).
gen_generic_sarima

Generate Generic Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
gen_ar1

Generate an Autoregressive Order 1 ( AR(1) ) sequence
evaluate

Evalute a time series or a list of time series models
gen_bi

Generate Bias-Instability Process
gen_nswn

Generate Non-Stationary White Noise Process
gen_dr

Generate a Drift Process
gen_model

Generate Time Series based on Model (Internal)
find_full_model

Find the Common Denominator of the Models
diag_boxpierce

Box-Pierce
gen_powerlaw

Generate a Power Law Process given \(\sigma^2\) and \(d\).
gen_qn

Generate a Quantisation Noise (QN) or Rounding Error Sequence
gen_rw

Generate a Random Walk without Drift
gen_sarima

Generate Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
gen_sarma

Generate Seasonal Autoregressive Order P - Moving Average Order Q (SARMA(p,q)x(P,Q)) Model
gen_sin

Generate a Sinusoidal Process given \(\alpha^2\) and \(\beta\).
brick_wall

Removal of Boundary Wavelet Coefficients
bootstrap_gof_test

Compute the Bootstrapped GoF Test
compare_acf

Comparison of Classical and Robust Correlation Analysis Functions
deriv_ma1

Analytic D matrix for MA(1) process
conv.ar1.to.gm

GM Conversion
custom_legend

Custom legend function
fk14_filter

fk14 filter construction
deriv_dr

Analytic D matrix for Drift (DR) Process
diag_ljungbox

Ljung-Box
imu_time

Pulls the IMU time from the IMU object
gm_to_ar1

Transform GM to AR1
invert_check

Check Invertibility Conditions
getObjFun

Retrieve GMWM starting value from Yannick's objective function
gof_test

Compute the GOF Test
gmwm_update_cpp

Update Wrapper for the GMWM Estimator
create_imu

Internal IMU Object Construction
gen_wn

Generate a Gaussian White Noise Process (WN(\(\sigma ^2\)))
gts

Create a simts TS object using time series data
gmwm_param_bootstrapper

Bootstrap for Estimating Both Theta and Theta SD
comb

Combine math expressions
hydro

Mean Monthly Precipitation, from 1907 to 1972
is.whole

Integer Check
gmwm_sd_bootstrapper

Bootstrap for Standard Deviations of Theta Estimates
is.gts

Is simts Object
intgr_vec

Discrete Intergral: Inverse Difference
obj_extract

Extract Object
logit_inv

Logit Inverse Function
diff_cpp

Lagged Differences in Armadillo
la20_filter

la20 filter construction
gen_arma

Generate Autoregressive Order \(p\) - Moving Average Order \(q\) (ARMA(\(p\),\(q\))) Model
mb16_filter

mb16 filter construction
fk8_filter

fk8 filter construction
model_theta

Generate the ts model object's theta vector
idf_arma

Indirect Inference for ARMA
gen_arma11

Generate an ARMA(1,1) sequence
model_score

Model Score
gen_lts_cpp

Generate Latent Time Series based on Model (Internal)
logit2_inv

Logit2 Inverse Function
mb24_filter

mb24 filter construction
la8_filter

la8 filter construction
gts_time

Time of a gts object
gen_ma1

Generate an Moving Average Order 1 (MA(1)) Process
fk6_filter

fk6 filter construction
gmwm

Generalized Method of Wavelet Moments (GMWM)
ma1_to_wv

Moving Average Order 1 (MA(1)) to WV
gmwm_engine

Engine for obtaining the GMWM Estimator
make_frame

Default utility function for various plots titles
pseudo_logit_inv

Pseudo Logit Inverse Function
plot_pred

Plot Time Series Forecast Function
derivative_first_matrix

Analytic D matrix of Processes
deriv_wn

Analytic D Matrix for a Gaussian White Noise (WN) Process
plot.simtsACF

Plot Auto-Covariance and Correlation Functions
dr_to_wv

Drift to WV
gen_ar1blocks

Generate AR(1) Block Process
rfilter

Time Series Recursive Filters
rgmwm

GMWM for Robust/Classical Comparison
lts

Generate a Latent Time Series Object from Data
+.ts.model

Add ts.model objects together
fk4_filter

fk4 filter construction
gmwm_imu

GMWM for (Robust) Inertial Measurement Units (IMUs)
print.imu

Print simts Objects
read_imu

Read an IMU Binary File into R
qmf

Quadrature Mirror Filter
resid_plot

Plot the Distribution of (Standardized) Residuals
gmwm_master_cpp

Master Wrapper for the GMWM Estimator
imu

Create an IMU Object
fk22_filter

fk22 filter construction
logit2

Logit2 Function
[.imu

Subset an IMU Object
plot.gmwm

Plot the GMWM with the Wavelet Variance
plot.lts

Plot Latent Time Series Object
reverse_vec

Reverse Armadillo Vector
select_filter

Select the Wavelet Filter
sum_field_vec

Accumulation of Armadillo field<vec>
lm_arma

MLR in Armadillo
logit

Logit Function
m2_drift

Second moment DR
value

Obtain the value of an object's properties
rtruncated_normal

Truncated Normal Distribution Sampling Algorithm
pseudo_logit

Pseudo Logit Function
np_boot_sd_med

Bootstrap standard error for the median
sarma_params_construct

Efficient way to merge items together
gen_mean

Generate a determinist vector returned by the matrix by vector product of matrix \(X\) and vector \(\beta\).
idf_arma_total

Indirect Inference for ARMA
sarma_expand_unguided

(Internal) Expand the SARMA Parameters
plot.PACF

Plot Partial Auto-Covariance and Correlation Functions
gen_matern

Generate a Matern Process given \(\sigma^2\), \(\lambda\) and \(\alpha\).
update.gmwm

Update (Robust) GMWM object for IMU or SSM
update_obj

Update the Attributes of Objects
update.lts

Update Object Attribute
plot.gts

Plot simts Time Series Data
gen_arima

Generate Autoregressive Order p, Integrated d, Moving Average Order q (ARIMA(p,d,q)) Model
getObjFunStarting

Retrieve GMWM starting value from Yannick's objective function
seq_len_cpp

Generate a sequence of values based on supplied number
predict.fitsimts

Time Series Prediction
set_seed

Set the RNG Seed from within Rcpp
predict.gmwm

Predict future points in the time series using the solution of the Generalized Method of Wavelet Moments
.acf

Auto-Covariance and Correlation Functions
mb4_filter

mb4 filter construction
lm_dr

Linear Regression with Drift
order_AR1s

Order AR1s by size of phi.
get_summary

Routing function for summary info
num_rep

Replicate a Vector of Elements \(n\) times
seq_cpp

Generate a sequence of values
opt_n_gof_bootstrapper

Bootstrap for Optimism and GoF
model_objdesc

Generate the ts model object description
haar_filter

Haar filter construction
guess_initial_old

Randomly guess a starting parameter
rw_to_wv

Random Walk to WV
orderModel

Order the Model
mb8_filter

mb8 filter construction
optimism_bootstrapper

Bootstrap for Optimism
sarma_components

Determine parameter expansion based upon objdesc
rev_col_subset

Reverse Subset Column
has

Obtain the value of an object's properties
sarma_calculate_spadding

Calculates Length of Seasonal Padding
rev_row_subset

Reverse Subset Row
la16_filter

la16 filter construction
print.gmwm

Print gmwm object
model_process_desc

Generate the ts model object's process desc
guess_initial

Randomly guess a starting parameter
jacobian_arma

Calculates the Jacobian for the ARMA process
print.fitsimts

Print fitsimts object
mean_diff

Mean of the First Difference of the Data
qn_to_wv

Quantisation Noise (QN) to WV
modwt_cpp

Maximum Overlap Discrete Wavelet Transform
minroot

Obtain the smallest polynomial root
theo_acf

Theoretical Autocorrelation (ACF) of an ARMA process
untransform_values

Revert Transform Values for Display
theo_pacf

Theoretical Partial Autocorrelation (PACF) of an ARMA process
sort_mat

Sort Matrix by Column
quantile_cpp

Find Quantiles
simts-package

simts: Time Series Analysis Tools
unitConversion

Convert Unit of Time Series Data
*.ts.model

Multiple a ts.model by constant
print.summary.gmwm

Print summary.gmwm object
transform_values

Transform Values for Optimization
modwt_wvar_cpp

Computes the (MODWT) wavelet variance
print.ts.model

Multiply a ts.model by constant
rank_models_cpp

Find the Rank Models result
w4_filter

w4 filter construction
wave_variance

Generate a Wave Variance for a Univariate Time Series
read.imu

Read an IMU Binary File into R
select

Time Series Model Selection
select_arima

Run Model Selection Criteria on ARIMA Models
scales_cpp

Computes the MODWT scales
sarma_expand

Expand Parameters for an SARMA object
savingrt

Personal Saving Rate
simplified_print_SARIMA

Simplify and print SARIMA model
simple_diag_plot

Basic Diagnostic Plot of Residuals
theta_ci

Generate the Confidence Interval for Theta Estimates
theoretical_wv

Model Process to WV
wn_to_wv

Gaussian White Noise to WV
wvar_cpp

Computes the (MODWT) wavelet variance
summary.fitsimts

Summary of fitsimts object
summary.gmwm

Summary of GMWM object
var_drift

Variance DR
vector_to_set

Conversion function of Vector to Set