Type: | Package |
Title: | Autoregressive and Moving Average Symmetric Models |
Version: | 1.0 |
Date: | 2018-09-23 |
Author: | Vinicius Quintas Souto Maior [aut,cre,cph] and Francisco Jose A Cysneiros [aut] |
Maintainer: | Vinicius Quintas Souto Maior <vinicius@de.ufpe.br> |
Description: | Functions for fitting the Autoregressive and Moving Average Symmetric Model for univariate time series introduced by Maior and Cysneiros (2018), <doi:10.1007/s00362-016-0753-z>. Fitting method: conditional maximum likelihood estimation. For details see: Wei (2006), Time Series Analysis: Univariate and Multivariate Methods, Section 7.2. |
License: | GPL-2 |
NeedsCompilation: | no |
Packaged: | 2018-09-23 14:24:51 UTC; vinicius |
Repository: | CRAN |
Date/Publication: | 2018-09-30 15:40:03 UTC |
Autoregressive and Moving Average Symmetric Models
Description
This package provides a set of functions to fitting of autoregressive and moving average symmetric models.
Details
Package: sym.arma
Type: Package
Version: 1.0
Date: 2018-09-23
License: GPL-2
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
References
Maior, V. Q. S. and Cysneiros, F. J. A. (2018). SYMARMA: a new dynamic model for temporal data on conditional symmetric distribution. Statitical Paper, 59, 75-97. doi: 10.1007/s00362-016-0753-z.
Wei, W. W. S. (2006). Time Series Analysis: Univariate and Multivariate Methods, 2nd edition. Pearson Addison Wesley. Section 7.2.1.
Efron, B. and Tibshirani, R. (1993). An Introduction to the Bootstrap. Chapman and Hall, New York, London.
Thode, Henry C. (2002). Testing for normality, New York: Marcel Dekker.
Cook, R.D. (1986). Assessment of local influence (with discussion). Journal of the Royal Statistical Society, B 48, 133-169.
Examples
library(sym.arma)
data(assets)
fit <- elliptical.ts(assets$msf[2122:2240],order=c(1,0,0),trace=TRUE)
qqplot(fit,envelope=FALSE)
Returns of the daily closing prices of assets, Standard and Poors 500 Index and T-bill rates
Description
Returns for all the trading days from November 1, 1993 to April 3, 2003.
Usage
data("assets")
Format
A data frame with 2363 observations on the following 8 variables.
tbill
a vector of returns of the T-bill rates for the trading days.
msf
a vector of returns of the daily closing prices of Microsoft Corporation.
sp500
a vector of returns of the Standard and Poors 500 index for the trading days.
ge
a vector of returns of the daily closing prices of General Electric Company.
ford
a vector of returns of the daily closing prices of Forward Industries Inc.
day
day of trading.
month
month of trading.
year
year of trading.
References
Ruppert, D (2004) Statistics and Finance. Springer, New York.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
Conditional Likelihood Ratio Test
Description
Likelihood ratio test for objects of class SYMARMA.
Usage
clr.test(model1, model2)
Arguments
model1 , model2 |
two models of class SYMARMA having the same set of records and the same type (“family”). |
Details
Likelihood ratio test checks the difference between -2*logLikelihood of the two models against the change in degrees of freedom using a chi-squared test. The records used in the dataset for both models MUST be the same.
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
Examples
serie <- symarma.sim(model=list(ar=c(0.2,0.5)),n=70,family="Normal",
varphi=1)
model0 <- elliptical.ts(serie,order=c(2,0,0))
model1 <- elliptical.ts(serie,order=c(1,0,0))
clr.test(model0,model1)
Autoregressive and Moving Average Symmetric Models
Description
Fit an SYMARMA model to a univariate time series. Fitting method: conditional maximum likelihood estimation.
Usage
elliptical.ts(Y, family="Normal", order=c(0,0,0), xreg=NULL,
include.mean=TRUE, epsilon=0.0001, maxit=100, trace="TRUE",
index1=NULL, index2=NULL, fixed=NULL)
Arguments
Y |
a univariate time series. |
family |
a description of the conditional distribution of each Y[t], given the set of past information. Symmetric distributions available for adjustment: Normal (Normal), Student-t (Student), Generalized Student-t (Gstudent), Exponential Power (ExpPower) (by Box & Tiao, 1973, ch 3), Logistic I (LogisticI), Logistic II (LogisticII), Generalized Logistic (Glogistic), Cauchy (Cauchy) and Contamined Normal (Cnormal). The default is to normal distribution. |
order |
a specification of the SYMARMA model: the three integer components (p, d, q) are the AR order, the degree of differencing, and the MA order. |
xreg |
optionally, a vector or matrix of external regressors, which must have the same number of rows as Y. |
include.mean |
should the SYMARMA model include a mean/intercept term? The default is TRUE. |
epsilon |
positive convergence tolerance e; the iterations converge when |fit - fit_old|/|fit| < e. Default is e=1e-04. |
maxit |
integer giving the maximal number of iterations. Default is 100 iterations. |
trace |
a logical indicating if output should be produced. |
index1 |
The parameter to Student-t and Exponential Power distributions or the first argument to Generalized Student-t, Generalized Logistic and Contamined Normal distributions. |
index2 |
The second argument to Generalized Student-t, Generalized Logistic (index2 = index2(index1)) and Contamined Normal distributions. |
fixed |
a optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied. |
Details
Different definitions of autoregressive and moving average models have different signs for the AR and/or MA coefficients. The dynamic component in SYMARMA model used here has
Y[t] = X[t]Beta + phi[1](Y[t-1] - X[t-1]Beta) + ... + phi[np](Y[t-np] - X[t-np]Beta) + theta[1]erro[t-1] + ... + theta[nq]erro[t-nq] + erro[t].
The estimation of the parameters that index the SYMARMA model is obtained by maximum conditional likelihood method on the first m observations, where m = max(np,nq).
The variance matrix of the estimates is found from the Hessian of the log-likelihood, and so may only be a rough guide.
Value
A list of class “Symarma” with components:
coefficients |
a vector of estimated AR, MA and regression coefficients. |
dispersion |
the estimated dispersion parameter. |
resid.raw |
the ordinary residuals. |
resid.stand |
the standardized residuals. |
fitted.values |
the fitted mean values. |
loglik |
the maximized log-likelihood. |
aic |
the AIC value corresponding to the log-likelihood. |
bic |
the BIC value corresponding to the log-likelihood. |
rmse |
the Root Mean Squared Error value corresponding to the ajusted model. |
iter |
the number of iterations used in the fitting. |
n |
the number of observations in the series. |
sd.coef |
a vector of estimated standard deviation of the coefficients. |
sd.disp |
estimated standard deviation of the dispersion parameter. |
family |
the family object used. |
X |
if requested, the vector or matrix of external regressors. |
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
References
Maior, V. Q. S. and Cysneiros, F. J. A. (2018). SYMARMA: a new dynamic model for temporal data on conditional symmetric distribution. Statitical Paper, 59, 75-97. doi: 10.1007/s00362-016-0753-z.
Wei, W. W. S. (2006). Time Series Analysis: Univariate and Multivariate Methods, 2nd edition. Pearson Addison Wesley. Section 7.2.1.
Box, M. J. and Tiao, G. C. (1973). Bayesian inference in statistical analysis. Londen: Addison-Wesley.
Examples
data(assets)
attach(assets)
# Return in the prices on Microsoft and SP500 index
N = length(msf)
.sp500 = ((sp500[2:N]-sp500[1:(N-1)])/sp500[1:(N-1)])*100
.msf = ((msf[2:N]-msf[1:(N-1)])/msf[1:(N-1)])*100
# The T-bill rates were divided by 253 to convert to a daily rate
.tbill = tbill/253
# Excess return in the prices on Microsoft and SP500 index
Y = .msf - .tbill[1:(N-1)]
X = .sp500 - .tbill[1:(N-1)]
# Period from April 4, 2002 to October 4, 2002
serie = Y[2122:2240]
aux = cbind(X[2122:2240])
# Returns best ARIMA model according to either AIC value.
# auto.arima(Y,xreg=aux,seasonal=FALSE,ic=c("aic"))
# Fit SYMARMA models
fit.1 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Normal")
fit.2 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Student", index1=4)
fit.3 = elliptical.ts(serie,order=c(3,0,1),xreg=aux,family="ExpPower",
index1=0, fixed=c(0,0,NA,NA,NA,NA))
Assessment of local influence in SYMARMA models
Description
This function discusses local influence analysis in SYMARMA models with Student-t and Gaussian distributions through Billor and Loyne's slope, Cook's curvature and Lesaffre and Verbeke's curvature using the methodology of benchmarks proposed by Zhang and King. Although this function is concerned primarily with local influence, some discussion of assessing global influence is presented.
Usage
influence(model, diag="slope", scheme="additive",iter=2000,
alpha=0.95, theta=0.05, plot="TRUE")
Arguments
model |
a result of a call to |
diag |
a description of the diagnostic method: “slope” for Billor and Loyne's, “cook” for Cook's and “lv” for Lesaffre and Verbeke's. The default is to slope. |
scheme |
a description of the perturbation scheme: “additive” for data additive perturbation and “dispersion” for dispersion parameter perturbation. The default is to additive. |
iter |
integer giving the number of iterations for construction of benckmarks. Default is 2,000 iterations. |
alpha |
percentile for benchmarks in assessing global influence (BS_0 and BC_0) and first assessing local influence (BS_1 and BC_1), e.g., 0.95. |
theta |
percentile for benchmarks in assessing global influence second assessing local influence (BS_2 and BC_2), e.g., 0.05. |
plot |
a logical indicating if plot should be produced. |
Value
Indiv1 |
individual benchmark type I. |
Indiv2 |
individual benchmark type II. |
VectorInd |
slope or curvature vector. |
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
References
Cook, R.D. (1986). Assessment of local influence (with discussion). Journal of the Royal Statistical Society, B 48, 133-169.
Billor, N. and Loynes, R.M. (1993). Local influence: A new approach. Communications in Statistics Theory and Methods, 22, 1595-1611. doi: 10.1080/03610929308831105.
Lesaffre, F. and Verbeke, G. (1998). Local influence in linear mixed models. Biometrics, 38, 963-974. doi: 10.2307/3109764.
Zhang, X. and King, M.L. (2005). Influence diagnostics in generalized autoregressive conditional heteroscedasticity processes. J. Business Econ. Statist., 23, 118-129. doi: 10.1198/073500104000 000217.
Examples
data(assets)
attach(assets)
# Return in the prices on Microsoft and SP500 index
N = length(msf)
.sp500 = ((sp500[2:N]-sp500[1:(N-1)])/sp500[1:(N-1)])*100
.msf = ((msf[2:N]-msf[1:(N-1)])/msf[1:(N-1)])*100
# The T-bill rates were divided by 253 to convert to a daily rate
.tbill = tbill/253
# Excess return in the d prices on Microsoft and SP500 index
Y = .msf - .tbill[1:(N-1)]
X = .sp500 - .tbill[1:(N-1)]
# Period from April 4, 2002 to October 4, 2002
serie = Y[2122:2240]
aux = cbind(X[2122:2240])
# Fit SYMARMA models
fit.1 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Normal")
fit.2 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Student", index1=4)
# Assessment of local influence
influence(fit.1,diag="slope",scheme="additive",iter=20,plot="FALSE")
influence(fit.2,diag="lv",scheme="additive",iter=20,plot="FALSE")
Forecasts from a fitted SYMARMA model
Description
See Maior and Cysneiros (2018) for details on this function.
Usage
predict(model, h, xreg = NULL)
Arguments
model |
a result of a call to |
h |
number of periods for forecasting. If xreg is used, h is ignored and the number of forecast periods is set to the number of rows of xreg. |
xreg |
future values of an regression variables. |
Value
pred |
predicted values. |
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
References
Brockwell, P. J. and Davis, R. A. (1991). Time Series and Forecasting Methods. Second edition. Springer, New York. Section 11.4.
Brockwell, P. J. and Davis, R. A. (1996). Introduction to Time Series and Forecasting. Springer, New York. Sections 5.1 and 7.6.
Maior, V. Q. S. and Cysneiros, F. J. A. (2018). SYMARMA: a new dynamic model for temporal data on conditional symmetric distribution. Statitical Paper, 59, 75-97. doi: 10.1007/s00362-016-0753-z.
Examples
data(assets)
attach(assets)
# Return in the prices on Microsoft and SP500 index
N = length(msf)
.sp500 = ((sp500[2:N]-sp500[1:(N-1)])/sp500[1:(N-1)])*100
.msf = ((msf[2:N]-msf[1:(N-1)])/msf[1:(N-1)])*100
# The T-bill rates were divided by 253 to convert to a daily rate
.tbill = tbill/253
# Excess return in the d prices on Microsoft and SP500 index
Y = .msf - .tbill[1:(N-1)]
X = .sp500 - .tbill[1:(N-1)]
# Period from April 4, 2002 to October 4, 2002
serie = Y[2122:2240]
aux = cbind(X[2122:2240])
# Fit SYMARMA models
fit.1 = elliptical.ts(serie,order=c(0,0,1),include.mean=FALSE,
family="Normal")
# Forecasts
predict(fit.1, h=10)
Quantile-Quantile Plots
Description
This function produces Q-Q plot with envelopes for a time series following conditional symmetric distribution.
Usage
qqplot(model, envelope = 0.95 , B = 400)
Arguments
model |
a result of a call to |
envelope |
confidence level for point-wise confidence envelope, or FALSE for no envelope. |
B |
integer; number of bootstrap replications for confidence envelope. Default is 400 iterations. |
Author(s)
Vinicius Quintas Souto Maior and Francisco Jose A. Cysneiros
Maintainer: Vinicius Quintas Souto Maior <vinicius@de.ufpe.br>
References
Cleveland, W.S. (1994). The Elements of Graphing Data, Hobart Press.
Thode, Henry C. (2002). Testing for normality, New York: Marcel Dekker.
Examples
data(assets)
attach(assets)
# Return in the prices on Microsoft and SP500 index
N = length(msf)
.sp500 = ((sp500[2:N]-sp500[1:(N-1)])/sp500[1:(N-1)])*100
.msf = ((msf[2:N]-msf[1:(N-1)])/msf[1:(N-1)])*100
# The T-bill rates were divided by 253 to convert to a daily rate
.tbill = tbill/253
# Excess return in the d prices on Microsoft and SP500 index
Y = .msf - .tbill[1:(N-1)]
X = .sp500 - .tbill[1:(N-1)]
# Period from April 4, 2002 to October 4, 2002
serie = Y[2122:2240]
aux = cbind(X[2122:2240])
# Fit SYMARMA models
fit.1 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Normal")
fit.2 = elliptical.ts(serie,order=c(0,0,1),xreg=aux,include.mean=FALSE,
family="Student",index1=4)
# Q-Q Plots
qqplot(fit.1, B = 50)
qqplot(fit.2, envelope = FALSE)
Simulate from an SYMARMA model
Description
Simulate from an SYMARMA model.
Usage
symarma.sim(model, n, family="Normal", index1, index2, varphi=1)
Arguments
model |
a list with component ar and/or ma giving the AR and MA coefficients respectively. Optionally a component order can be used. An empty list gives an SYMARMA(0,0) model, that is white noise. |
n |
length of output series, before un-differencing. A strictly positive integer. |
family |
a description of the conditional distribution of each Y[t], given the set of past information. |
index1 , index2 |
the arguments of the symmetric distributions indexed by parameters. |
varphi |
the dispersion parameter of the innovations generated. Default is varphi=1. |
Details
See elliptical.ts
for the precise definition of an SYMARMA model.
The SYMARMA model is checked for stationarity.
SYMARMA models are specified via the order component of model, in the same way as for elliptical.ts
. Other aspects
of the order component are ignored, but inconsistent specifications of the MA and AR orders are detected. The un-differencing
assumes previous values of zero, and to remind the user of this, those values are returned.
Value
A time-series object of class “ts”.
See Also
Examples
serie0 <- symarma.sim(model=list(ar=c(0.3,0.2),ma=c(0.34)),n=70,
varphi=1)
serie1 <- symarma.sim(model=list(ar=c(0,0,0.65)),n=70,family="Student",
index1 = 4,varphi=1)