Contents Previous Next functions

STSA Toolbox Function Reference

Function Reference
This reference provides a synopsis of each function provided with the STSA toolbox. See STSA, The Statistical Time Series Analysis Toolbox for a description of STSA, The Statistics Time Series Analysis Toolbox, and O-Matrix: High-Performance Math Software for Engineeering, Science and Technical Computing for more details on O-Matrix.

ARMA Analysis Functions
The following functions are located in the \ARMA directory of the STSA distribution.
acfplot.oms - Plot and return the autocorrelation and partial autocorrelation functions in a captioned window
acvf.oms - Estimate the autocovariance and autocorrelation functions
ar_acov.oms - Compute the theoretical autocovariances of an AR model
ar_lad.oms - Autoregressive estimation using Least Absolute Deviations (LAD)
ar_noise.oms - Autoregressive filter
ar_order.oms - Autoregressive order selection using AICc (corrected Akaike) and BIC (Schwarz) criteria
ar_to_ma.oms - AR to MA polynomial inversion
ar_yw.oms - Autoregressive model estimation using Levinson's algorithm (Yule-Walker)
arma_acov.oms - Compute the theoretical autocovariances of an ARMA model
arma_details.oms - Compute and optionally print estimation results and statistics from an ARMA model
arma_estimate.oms - Non-linear least squares (LS) estimation of an ARMA model with no backcasting
arma_forecast.oms - ARMA forecasting. The infinite MA representation is used for the msef
arma_noise.oms - ARMA filter
arma_residual_diagnostics.oms - Formatted screen output and residual graphs
arma_restricted_estimate.oms - Non-linear least squares (LS) estimation of an ARMA model with no backcasting and parameter restrictions (bounds)
arma_roots.oms - Get the roots of the AR and MA characteristic polynomials (bounds)
arma_simulate.oms - Simulate a Gaussian ARMA(p,q) model
arma_to_ar.oms - ARMA to AR polynomial division
arma_to_ma.oms - ARMA to MA polynomial division
ccf.oms - Compute the cross-correlation function of two time series
dlw.oms - The Durbin-Levinson-Whittle algorithm for best linear predictors
dmtest.oms - Perform the Diebold-Mariano test for evaluating the forecasts between two competing models
granger_causality.oms - Test for Granger-type causality between two time series
lag.oms - Lagging all columns of a matrix
ma_acov.oms - Compute the theoretical autocovariances of an MA model
ma_noise.oms - Moving average filter
ma_to_ar.oms - MA to AR polynomial inversion
pacf.oms - Compute the partial autocorrelation function
packr.oms - Eliminate row-wise all missing values from a matrix
plot_ccf.oms - Plot the cross-correlation function
print_acf_summary.oms - formatted screen output for ACF, PACF and Q-statistics
qstat.oms - Compute the Ljung-Box test for autocorrelation
seqlags.oms - Sequential lags of all columns of a matrix
spec_acvf.oms - Compute the ACVF and ACF using the fourier transform
transfer_details.oms - Transfer function details. Similar output to the arma_details function
transfer_estimate.oms - Estimate transfer function by non-linear least squares
transfer_filter.oms - Transfer function filter
transfer_forecast.oms - Transfer function forecasting
transfer_noise.oms - Transfer function noise
var_estimate.oms - Vector AR estimation by least squares
var_forecast.oms - Vector AR forecasting
var_order.oms - VAR order selection using AICc and BIC
var_to_ma.oms - VAR to MA representation through VAR(1) and the companion matrix and MSE matrix

Bayesian Analysis Functions
The following functions are located in the \BAYES directory.
FG_fseas.oms - Get the frequencies and the observation and system matrices for the Fourier form seasonal model
fit_fop_averageDLM.oms - Mixture first order polynomial DLM
fit_fop_DLM.oms - In-sample, one-step-ahead forecasting using a first order polynomial DLM
fit_rtoDLM.oms - In-sample, one-step-ahead forecasting using a regression through the origin (rto) DLM with constant, unknown observational variance
fit_tsDLM.oms - In-sample, one-step-ahead forecasting of a time series DLM with constant system matrix and constant or time-varying observation matrix (regressors), unknown observational variance, component discounting and diffuse or reference priors
forecast_tsDLM.oms - Out-of-sample, h-steps-ahead forecasting of a time series DLM with constant system matrix and constant or time-varying observation matrix (regressor unknown observational variance, component discounting and diffuse or reference priors
interval_forecast.oms - Compute a confidence interval using the DLM forecasts
is_observable.oms - Test for observability in a univariate DLM
P_seas.oms - Get the cyclic matrix P for free form seasonal model
reference_tsDLM.oms - Compute reference prior for univariate, time series DLM with constant unknown observational variance
sfe_tsDLM.oms - Get standardized residuals
simulate_fopDLM.oms - Simulate a first order polynomial normal DLM with constant parameters but with constant or time-varying variances
trend_seas.oms - Get the observation and system matrices for trend model with or without free form seasonal

Filter Functions
The following functions are located in the \FILTER directory.
ewma.oms - Exponentially weighted moving average smoothing
ewma_estimate.oms - Estimate the smoothing factor of the EWMA model
fir_filter.oms - Finite impulse response filtering via convolution
global_ts_estimate.oms - Estimate the parameters of a global trend plus seasonal components model using least squares
global_ts_filter.oms - Compute residuals (filtered values) based on a global trend and seasonal components
global_ts_forecast.oms - Compute forecasts based on a global trend and seasonal components
holt_winters_filter.oms - Filtering and forecasting using the additive Holt-Winters exponential smoothing model
holt_winters_optimize.oms - Estimate the optimal smoothing parameters for use in Holt-Winters forecasting
holt_winters_residuals.oms - Auxiliary function used for the optimization of the smoothing parameters in the Holt-Winters forecasting model
ltikf.oms - Linear, time-invariant Kalman filtering and forecasting
ma_smooth.oms - Smoothing using arithmetic averages
savitzky_golay.oms - Savitzky-Golay filtering
ts_estimate.oms - Estimate the parameters of the Trend + Seasonal structural model using maximum likelihood
ts_filter.oms - Trend + Seasonal structural model filtering and forecasting based on Kalman filtering
ts_loglf.oms - Negative log-likelihood function for Trend + Seasonal structural model

Nonlinear Analysis Functions
The following functions are located in the \NONLIN directory.
arsign.oms - Estimate a sign-autoregression
derivatives_arma_garch.oms - Compute analytical Jacobian or gradient for ARMA-GARCH model
estimate_arma_garch.oms - Estimate the GARCH parameters of an ARMA-GARCH model
estimate_garch.oms - Estimate the GARCH parameters of an ARMA-GARCH model
filter_arma_garch.oms - Get the innovations and the conditional variance of a time series based on an ARMA-GARCH model.
foreval.oms - MAE and MSE of forecast errors
grid_search_garch11.oms - Two-dimensional grid search on the unit square for estimating the parameters of a GARCH(1,1) model.
KSEDtest.oms - Compute the Kolmogorov-Smirnov test for equality of distributions
KSEDtest_edf.oms - Compute the empirical distribution of the Kolmogorov-Smirnov test for the equality of the distribution of two time series using the maximum entropy bootstrap
linearityF.oms - Perform an F-type test for non-linearity.
loglf_arma_garch.oms - Compute the negative of the Gaussian log-likelihood for an ARMA-GARCH model.
log_arma_garch_t.oms - Compute the negative of the t(df) log-likelihood for an ARMA-GARCH model.
make_ygrid.oms - Support function for creating a grid of values with specific number of steps.
me_bootstrap.oms - Bootstrap a time series using the maximum entropy bootstrap.
start_arma_garch.oms - Compute appropriate starting values for estimating a GARCH model.
tar_select.oms - TAR model selection using the BIC criterion
tarlsq.oms - Estimate a one-regime threshold AR (TAR) model using LS

Nonparametric Time Series Analysis Functions
The following functions are located in the \NONPAR directory. This directory contains functions for nonparametric, nonlinear time series analysis.
arf_cubic_spline.oms - Nonparametric autoregression and forecasting using cubic splines.
density.oms - Compute kernel density estimator.
density_bandwidth.oms - Compute reference bandwidth for density estimation.
distribution.oms - Compute empirical distribution.
estimate_cubic_spline.oms - Regression smoothing by cubic splines.
extract_quantile.oms - Extract a vector of conditional quantiles after conditional empirical cdf estimation.
form_cubic_spline.oms - Auxialiary function for forming the columns of a cubic spline.
gaussian_kernel.oms - Multivariate Gaussian kernel.
isvector.oms - Support function: check whether the input is a vector.
lparf.oms - Nonparametric autoregression and forecasting using local polynomial least squares.
lparf_mcv.oms - Multifold cross-validation for nonparametric autoregression.
lpfarf.oms - Nonparametric functional coefficient (stochastic) autoregression using local linear least squares
lpfarf_mcv.oms - Multifold cross-validation for nonparametric functional autoregression.
lpflsq.oms - Nonparametric functional coefficient (stochastic) regression using local linear least squares.
lpgcv.oms - Bandwidth selection using the nonparametric version of bias-corrected AIC and GCV.
lplsq.oms - Nonparametric regression using local polynomial least squares.
moments.oms - Compute sample moments.
npdf.oms - The standard normal pdf.
npsmooth.oms - Nonparametric smoothing and forecasting (trend extrapolation) of a time series.
optimal_kernel.oms - The "optimal" (Epanechnikov) kernel.
plm.oms - Nonparametric estimation of a partially linear model.
wcecdf.oms - Conditional empirical cdf estimation for vectors of evaluation points yt and xt using the weighted NW estimator.
wcecdf_yx.oms - Support functions for conditional empirical cdf estimation at single evaluation points yt and xt using a weighted NW estimator. See the function wcecdf.oms for the main function that is called in applications with user's data.

Proper Orthogonal Decomposition
The following functions are located in the \POD directory. This directory contains functions for performing Singular Spectrum Analysis (SSA) on univariate time series. SSA is part of the more general class of procedures grouped under the name Proper Orthogonal Decomposition (POD).
colquartiles.oms - Compute the quartiles (25%,50% and 75% quantiles) of the columns of a matrix.
decompose_trajectory.oms - Perform SVD decomposition of the trajectory matrix.
diagonal_averaging.oms - Perform diagonal averaging on a matrix.
eigenvalue_plot.oms - Plot the eigenvalues of the decomposed trajectory matrix.
forecast_trajectory.oms - Forecast components of decomposed time series.
make_trajectory.oms - Construct trajectory matrix of original time series.
reconstruct_trajectory.oms - Reconstruct a component of the decomposition of the original time series.
weighted_correlation2.oms - Compute the weighted correlation coefficient between two reconstructed components; accurate separation of components is indicated by low values of the weighted correlation.

Spectral Analysis Functions
The following functions are located in the \SPECTRAL directory.
acov_FD.oms - Compute the autocovariances of a fractionally integrated series
acov_FGN.oms - Compute the autocovariances of fractional Gaussian noise
acvf_cspectrum.oms - Cross-spectral estimation using the DFT of the smoothed cross-covariance function
acvf_spectrum.oms - Spectral estimation using the DFT of the smoothed autocovariance function
amplitude_phase.oms - Compute the amplitude and phase of two time series
ar_spectrum.oms - Spectral estimation using an autoregressive approximation
arfima_estimate.oms - ARFIMA(p,d,q) model estimation by LS using the STSA gauss_newton function
arfima_filter.oms - ARFIMA filter
arfima_forecast.oms - ARFIMA forecasting using AR approximation
fdiff.oms - Fractional differencing
fft_acov.oms - Auxiliary function for simulation of fractionally integrated series
fourier.oms - Compute the fourier transform and periodogram for a time series
fractional_GPH.oms - Estimate the fractional order of a time series using the Geweke and Porter-Hudak regression
fractional_Whittle.oms - Estimate the fractional order of a time series using the Whittle likelihood approximation
impulse_response.oms - Compute and optionally plot the impulse response coefficients of a linear filter
plot_fourier.oms - Plot the time series, the fourier transform and the periodogram
plot_spectrum.oms - Plot the spectrum
simulate_FD.oms - Simulate a fractionally integrated time series
simulate_FGN.oms - Simulate a fractional Gaussian noise series
sinetaper.oms - Compute the sine taper function
spectrum.oms - Compute the fourier spectrum using the sine taper
squared_coherence.oms - Compute and optionally plot the squared coherency function between two time series

Random Number Generators
The following RNG functions are located in the \RNG directory. The STSA RNG functions supplement, and work with the Statistics Functions provided in the base O-Matrix package.
ccauchy.oms - Returns the cumulative density function (cdf) of the Cauchy distribution
cexpo.oms - Returns the cumulative density function (cdf) of the exponential distribution
cgaussian.oms - Returns the cumulative density function (cdf) of the Gaussian (normal) distribution
cgumbel.oms - Returns the cumulative density function (cdf) of the Gumbel (extreme value) distribution
clogistic.oms - Returns the cumulative density function (cdf) of the Gumbel (extreme value) distribution
cstudent.oms - Returns the cumulative density function (cdf) of the t distribution, (Student) distribution
cuniform.oms - Returns the cumulative density function (cdf) of the uniform distribution in the interval [a,b]
icauchy.oms - Returns the inverse cdf of the Cauchy distribution
iexpo.oms - Returns the inverse cdf of the exponential distribution
igaussian.oms - Returns the inverse cdf of the Gaussian distribution
igumbel.oms - Returns the inverse cdf of the Gumbel (extreme value) distribution
ilogistic.oms - Returns the inverse cdf of the logistic distribution
istudent.oms - Returns the inverse cdf of the t (Student) distribution
iuniform.oms - Returns the inverse cdf of the uniform distribution in the interval [a,b]

Optimization Functions
The following functions are located in the \OPTIMIZE directory.
bhhh_ml.oms - Nonlinear Maximum Likelihood (ML) estimation using the Berndt, Hall, Hall and Hausman (BHHH) algorithm
gauss_newton.oms - Nonlinear least squares optimization using Gauss-Newton
newton_raphson.oms - Nonlinear optimization using Newton-Raphson with optional BFGS rank 2 symmetric update

Statistics Functions
The STSA toolbox provides numerous general and time-series specific statistics functions which are available in the \STATS directory. The STSA statistical analysis and visualization functions supplement, and work with the Statistics Functions provided in the base O-Matrix package.
boxcox_estimate.oms - Estimate the optimal Box-Cox transformation exponent using maximum likelihood
boxcox_invert.oms - Invert the Box-Cox transformation
boxcox_loglf.oms - The Box-Cox transformation negative log-likelihood function
boxcox_transform.oms - The Box-Cox transformation to near Gaussianity
boxplot.oms - Box and whiskers plot
cdfchi.oms - The chi-squared cdf complement
cmoments.oms - Compute sample central moments
complement.oms - Given a set of indexes s1 from the set of the first K integers, compute the complement set
descriptives.oms - Compute, and optionally print, descriptive statistics
dlog.oms - Compute the growth rate (log-differences) of a time series
expand.oms - Expand a vector into a symmetric matrix
expfit.oms - Non-linear least squares (LS) estimation of an exponential decay/growth model, with unknown y-offset, of the form y = A*exp(B*x) + C + error
factor_analysis_pca.oms - Factor Analysis using Principal Components
fast_plot.oms - Fast plotting of a time series with title, color, style, grid and axis title controls with the remaining plotting parameters set to defaults. The plot is made in a new graphics window
Gaussianity_ADtest.oms - Compute the Anderson-Darling test for Gaussianity
Gaussianity_CVMtest.oms - Compute the Cramer-Von Misses test for Gaussianity
Gaussianity_Ftest.oms - Tests for Gaussianity based on sample moments
Gaussianity_KStest.oms - Empirical cdf and the Kolmogorov-Smirnov test for Gaussianity
lad.oms - Estimation of a linear regression model using Least Absolute Deviations (LAD)
load_binary.oms - Load a previously saved binary data file into an O-Matrix data matrix
lsq.oms - Linear Least Squares
make_dates.oms - Making a string with monthly or quarterly dates
pca.oms - Principal Components Analysis
pdfchi.oms - The chi-squared pdf
print_estimation_results.oms - Auxiliary function for formatted screen output
qqplot.oms - Quantile-Quantile (QQ) plot and QQ correlation coefficient
quantiles.oms - Compute the sample quantiles of a time series
regress.oms - Linear Least Squares with screen output
returns.oms - Compute the pth order return of a time series (log-differences at lag p)
rolling_lsq.oms - Rolling Linear Least Squares
save_binary.oms - Save an O-Matrix data matrix into binary format
scatterplot.oms - Produces a scatterplot with non-parametric regression fit
screeplot.oms - Plot the eigenvalues or the cumulative proportion of explained variance after PCA
seqret.oms - Compute a matrix of sequential returns
standardize.oms - Standardize a matrix of observations
trend.oms - Estimate a polynomial time trend
vcov.oms - Estimate the sample mean, contemporaneous covariance and correlation as well as the lagged covariances and correlations and the long-run covariance and correlation (zero frequency spectral matrix)