Title: | Modified Iterative Cumulative Sum of Squares Algorithm |
---|---|
Description: | Companion package of Carrion-i-Silvestre & Sansó (2023): "Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series". It implements the Modified Iterative Cumulative Sum of Squares Algorithm, which is an extension of the Iterative Cumulative Sum of Squares (ICSS) Algorithm of Inclan and Tiao (1994), and it checks for changes in the unconditional variance of a time series controlling for the tail index of the underlying distribution. The fourth order moment is estimated non-parametrically to avoid the size problems when the innovations are non-Gaussian (see, Sansó et al., 2004). Critical values and p-values are generated using a Generalized Extreme Value distribution approach. References Carrion-i-Silvestre J.J & Sansó A (2023) <https://www.ub.edu/irea/working_papers/2023/202309.pdf>. Inclan C & Tiao G.C (1994) <doi:10.1080/01621459.1994.10476824>, Sansó A & Aragó V & Carrion-i-Silvestre J.L (2004) <https://dspace.uib.es/xmlui/bitstream/handle/11201/152078/524035.pdf>. |
Authors: | Josep Lluís Carrion-i-Silvestre [aut], Andreu Sansó [aut, cre] |
Maintainer: | Andreu Sansó <[email protected]> |
License: | GPL-2 |
Version: | 0.2.0 |
Built: | 2025-02-19 03:13:35 UTC |
Source: | https://github.com/cran/micss |
Computes the estimator of the tail index proposed by Hill (1975).
alpha_hill(x, k)
alpha_hill(x, k)
x |
A numeric vector. |
k |
Fraction of the upper tail to be used to estimate of the tail index. |
alpha
: Estimated tail index.
sd.alpha
: Standard error.
s
: Number of observations used in the estimation.
B. Hill (1975): A Simple General Approach to Inference About the Tail of a Distribution. The Annals of Mathematical Statistics 3, 1163-1174.
alpha_hill(rnorm(500),k=0.1)
alpha_hill(rnorm(500),k=0.1)
Computes the estimator of the tail index proposed by Nicolau & Rodrigues (2019).
alpha_nr(y, k)
alpha_nr(y, k)
y |
A numeric vector. |
k |
Fraction of the upper tail to be used to estimate of the tail index. |
alpha
: Estimated tail index.
sd.alpha
: Standard error.
J. Nicolau and P.M.M. Rodrigues (2019): A new regression-based tail index estimator. The Review of Economics and Statistics 101, 667-680.
alpha_nr(rnorm(500),k=0.1)
alpha_nr(rnorm(500),k=0.1)
Log returns of the exchange rate South African Rand versus United States Dollar.
data(logReturnsRandDollar)
data(logReturnsRandDollar)
Time series with 7705 observations.
J.L. Carrion-i-Silvestre and A. Sansó
Paulo Rodrigues
J.L. Carrion-i-Silvestre & A. Sansó (2023): Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series.
data(logReturnsRandDollar) names(data)
data(logReturnsRandDollar) names(data)
Implements the ICSS algorithm of Inclan and Tiao (1994) using the CUMSUMQ test detailed in Carrion-i-Silvestre & Sansó (2023)
icss(e,sig.lev=0.05,kmax=NULL,alpha=NULL)
icss(e,sig.lev=0.05,kmax=NULL,alpha=NULL)
e |
A numeric vector. Stationary variable on which the constancy of unconditional variance is tested. |
sig.lev |
Significance level. The default value is 0.05 |
kmax |
Maximum lag to be used for the estimation of the long-run fourth order moment. If not reported, an automatic procedure computes it depending on the sample size. |
alpha |
Tail index. If not reported, it is set at 4, which was the implicit assumption of Inclan & Tiao (1994). Values between 2 and 4 are allowed because this function is used by micss. |
nb |
Number of breaks found by the algorithm. |
tb |
Vector with the time breaks. |
J.L. Carrion-i-Silvestre and A. Sanso.
J.L. Carrion-i-Silvestre & A. Sansó (2023): Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series.
C. Inclan & G.C. Tiao (1994): Use of Cumulative Sums of Squares for Retrospective Detection of Changes of Variance. Journal of the American Statistical Association 89, 913-923.
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- icss(e) print.icss(o)
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- icss(e) print.icss(o)
Computes the CUMSUMQ test to test for changes in the unconditional variance and reports the p-value adapted to the tail index and sample size
kappa_test(e,sig.lev=0.05,alpha=NULL,kmax=NULL)
kappa_test(e,sig.lev=0.05,alpha=NULL,kmax=NULL)
e |
A numeric vector. Stationary variable on which the constancy of unconditional variance is tested. |
sig.lev |
Significance level. The default value is 0.05. |
alpha |
Tail index. Must be a number between 2 and 4. The default value is 4. |
kmax |
Maximum lag to be used for the estimation of the long-run fourth order moment. If not reported, an automatic procedure computes it depending on the sample size. |
It is only computed if the sample size is greater than 25 observations.
kappa |
CUMSUMQ test. |
tb |
Possible time of the break (with maximum value of the statistic). |
cv |
critical value at the specified significance level. |
p.val |
p-value. |
J.L. Carrion-i-Silvestre and A. Sanso.
J.L. Carrion-i-Silvestre & A. Sansó (2023): Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series.
data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # whitening kappa_test(e)
data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # whitening kappa_test(e)
Log returns of the exchange rate South African Rand versus United States Dollar.
data(logReturnsRandDollar)
data(logReturnsRandDollar)
Time series with 7705 observations.
J.L. Carrion-i-Silvestre and A. Sansó.
Paulo Rodrigues
J.L. Carrion-i-Silvestre & A. Sansó (2023): Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series.
data(logReturnsRandDollar) names(data) # The following example replicates some of the results of Table 6 in # Carrion-i-Silvestres & Sanso (2023) data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # pre-whitening m <- micss(e) print.micss(m)
data(logReturnsRandDollar) names(data) # The following example replicates some of the results of Table 6 in # Carrion-i-Silvestres & Sanso (2023) data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # pre-whitening m <- micss(e) print.micss(m)
Estimation of the long-run variance using the Barlett window.
lrv.spc.bartlett(x, kmax = NULL)
lrv.spc.bartlett(x, kmax = NULL)
x |
Stationary variable. A numeric vector. |
kmax |
Maximum lag to be used for the long-run estimation of the variance. |
Estimates the log-run fourth order moment when x are the squares of a variable.
Estimation of the long-run variance.
D. Sul, P.C.B. Phillips & C.Y. Choi (2005): Prewhitening Bias in HAC Estimation, Oxford Bulletin of Economics and Statistics 67, 517-546.
D.W.K. Andrews & J.C. Monahan (1992): An Improved Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimator. Econometrica 60, 953-966.
lrv.spc.bartlett(rnorm(100))
lrv.spc.bartlett(rnorm(100))
Implements the MICSS algorithm of Carrion-i-Silvestre & Sansó (2023).
micss(e,sig.lev=0.05,kmax=NULL,alpha=NULL,tail.est="NR",k=0.1)
micss(e,sig.lev=0.05,kmax=NULL,alpha=NULL,tail.est="NR",k=0.1)
e |
A numeric vector. Stationary variable on which the constancy of unconditional variance is tested. |
sig.lev |
Significance level. The default value is 0.05. |
kmax |
Maximum lag to be used for the estimation of the long-run fourth order moment. If not reported, an automatic procedure computes it depending on the sample size. |
alpha |
Tail index. If not reported, it is estimated automatically. |
tail.est |
Estimator of the tail index. The default value is "NR", which uses Nicolau & Rodrigues (2019) estimator. "Hill" uses the Hill's (1975) estimator. |
k |
Fraction of the upper tail to be used to estimate of the tail index. The default value is 0.1. |
The tail index is estimated using the absolute values.
icss |
An object with the output of the icss algorithm. |
alpha |
An object with the output of the estimate.alpha. |
J.L. Carrion-i-Silvestre and A. Sansó.
J.L. Carrion-i-Silvestre & A. Sansó (2023): Generalized Extreme Value Approximation to the CUMSUMQ Test for Constant Unconditional Variance in Heavy-Tailed Time Series.
B. Hill (1975): A Simple General Approach to Inference About the Tail of a Distribution. The Annals of Mathematical Statistics 3, 1163-1174.
J. Nicolau & P.M.M. Rodrigues (2019): A new regression-based tail index estimator. The Review of Economics and Statistics 101, 667-680.
icss
estimate.alpha
print.micss
plot.icss
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) print.micss(o) # The following example replicates some of the results of Table 6 in # Carrion-i-Silvestres & Sanso (2023) data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # pre-whitening m <- micss(e) print.micss(m)
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) print.micss(o) # The following example replicates some of the results of Table 6 in # Carrion-i-Silvestres & Sanso (2023) data(logReturnsRandDollar) e <- whitening(data$rand.dollar)$e # pre-whitening m <- micss(e) print.micss(m)
Plots the output of the ICSS algorithm.
## S3 method for class 'icss' plot(x, type = "std", title = NULL, ...)
## S3 method for class 'icss' plot(x, type = "std", title = NULL, ...)
x |
|
type |
Type of graphic. 3 possibilities: "std", which is the default, plots the absolute value of the variable and the standard deviation; "var" plots the squares of the variable and the variance; "res.std" plots the standardized residuals. |
title |
Title of the graphic. |
... |
Further arguments passed to or from other methods. |
No return value. It generates a plot the output of micss or icss
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) plot.icss(o,title="Example of the MICSS algorithm")
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) plot.icss(o,title="Example of the MICSS algorithm")
Prints the output of icss.
## S3 method for class 'icss' print(x, ...)
## S3 method for class 'icss' print(x, ...)
x |
An object with the output of the icss algorithm. |
... |
Further arguments passed to or from other methods. |
Used internally by icss.
No return value. It prints the output of icss
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- icss(e) print.icss(o)
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- icss(e) print.icss(o)
Prints the output of micss.
## S3 method for class 'micss' print(x, ...)
## S3 method for class 'micss' print(x, ...)
x |
An object with the output of the micss algorithm. |
... |
Further arguments passed to or from other methods. |
No return value. It prints the output of micss
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) print.micss(o)
set.seed(2) e <- c(stats::rnorm(200),3*stats::rnorm(200)) o <- micss(e) print.micss(o)
Eliminates the autocorrelation of a variable using an AR model.
whitening(y, kmax = NULL)
whitening(y, kmax = NULL)
y |
A numeric vector. Variable to be whiten. |
kmax |
Maximum lag to be used for the long-run estimation of the variance. If not specified uses [12*(t/100)^(1/4)]. |
Selects the model using the Bayes Information Criterium.
e
: Whiten variable.
rho
: Vector of autoregressive parameters.
lag
: number of lags used.
whitening(rnorm(100))
whitening(rnorm(100))