Package 'micss'

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

Help Index


Hill's estimator of the tail index

Description

Computes the estimator of the tail index proposed by Hill (1975).

Usage

alpha_hill(x, k)

Arguments

x

A numeric vector.

k

Fraction of the upper tail to be used to estimate of the tail index.

Value

  • alpha: Estimated tail index.

  • sd.alpha: Standard error.

  • s: Number of observations used in the estimation.

References

B. Hill (1975): A Simple General Approach to Inference About the Tail of a Distribution. The Annals of Mathematical Statistics 3, 1163-1174.

See Also

alpha_nr

Examples

alpha_hill(rnorm(500),k=0.1)

Nicolau & Rodrigues estimator of the tail index

Description

Computes the estimator of the tail index proposed by Nicolau & Rodrigues (2019).

Usage

alpha_nr(y, k)

Arguments

y

A numeric vector.

k

Fraction of the upper tail to be used to estimate of the tail index.

Value

  • alpha: Estimated tail index.

  • sd.alpha: Standard error.

References

J. Nicolau and P.M.M. Rodrigues (2019): A new regression-based tail index estimator. The Review of Economics and Statistics 101, 667-680.

See Also

alpha_hill

Examples

alpha_nr(rnorm(500),k=0.1)

Data used in the examples

Description

Log returns of the exchange rate South African Rand versus United States Dollar.

Usage

data(logReturnsRandDollar)

Value

Time series with 7705 observations.

Author(s)

J.L. Carrion-i-Silvestre and A. Sansó

Source

Paulo Rodrigues

References

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.

Examples

data(logReturnsRandDollar)
names(data)

Iterative Cumulative Sum of Squares Algorithm

Description

Implements the ICSS algorithm of Inclan and Tiao (1994) using the CUMSUMQ test detailed in Carrion-i-Silvestre & Sansó (2023)

Usage

icss(e,sig.lev=0.05,kmax=NULL,alpha=NULL)

Arguments

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.

Value

nb

Number of breaks found by the algorithm.

tb

Vector with the time breaks.

Author(s)

J.L. Carrion-i-Silvestre and A. Sanso.

References

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.

See Also

micss print.icss plot.icss

Examples

set.seed(2)
e <- c(stats::rnorm(200),3*stats::rnorm(200))
o <- icss(e)
print.icss(o)

CUMSUMQ test to test for changes in the unconditional variance

Description

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

Usage

kappa_test(e,sig.lev=0.05,alpha=NULL,kmax=NULL)

Arguments

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.

Details

It is only computed if the sample size is greater than 25 observations.

Value

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.

Author(s)

J.L. Carrion-i-Silvestre and A. Sanso.

References

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.

See Also

micss

Examples

data(logReturnsRandDollar)
e <- whitening(data$rand.dollar)$e # whitening
kappa_test(e)

Data used in the examples

Description

Log returns of the exchange rate South African Rand versus United States Dollar.

Usage

data(logReturnsRandDollar)

Value

Time series with 7705 observations.

Author(s)

J.L. Carrion-i-Silvestre and A. Sansó.

Source

Paulo Rodrigues

References

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.

Examples

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)

lrv.spc.bartlett

Description

Estimation of the long-run variance using the Barlett window.

Usage

lrv.spc.bartlett(x, kmax = NULL)

Arguments

x

Stationary variable. A numeric vector.

kmax

Maximum lag to be used for the long-run estimation of the variance.

Details

Estimates the log-run fourth order moment when x are the squares of a variable.

Value

Estimation of the long-run variance.

References

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.

Examples

lrv.spc.bartlett(rnorm(100))

Modiffied Iterative Cumulative Sum of Squares Algorithm

Description

Implements the MICSS algorithm of Carrion-i-Silvestre & Sansó (2023).

Usage

micss(e,sig.lev=0.05,kmax=NULL,alpha=NULL,tail.est="NR",k=0.1)

Arguments

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.

Details

The tail index is estimated using the absolute values.

Value

icss

An object with the output of the icss algorithm.

alpha

An object with the output of the estimate.alpha.

Author(s)

J.L. Carrion-i-Silvestre and A. Sansó.

References

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.

See Also

icss estimate.alpha print.micss plot.icss

Examples

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)

plot.icss

Description

Plots the output of the ICSS algorithm.

Usage

## S3 method for class 'icss'
plot(x, type = "std", title = NULL, ...)

Arguments

x

An object with the output of icss or micss.

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.

Value

No return value. It generates a plot the output of micss or icss

Examples

set.seed(2)
e <- c(stats::rnorm(200),3*stats::rnorm(200))
o <- micss(e)
plot.icss(o,title="Example of the MICSS algorithm")

print.icss

Description

Prints the output of icss.

Usage

## S3 method for class 'icss'
print(x, ...)

Arguments

x

An object with the output of the icss algorithm.

...

Further arguments passed to or from other methods.

Details

Used internally by icss.

Value

No return value. It prints the output of icss

Examples

set.seed(2)
e <- c(stats::rnorm(200),3*stats::rnorm(200))
o <- icss(e)
print.icss(o)

print.micss

Description

Prints the output of micss.

Usage

## S3 method for class 'micss'
print(x, ...)

Arguments

x

An object with the output of the micss algorithm.

...

Further arguments passed to or from other methods.

Value

No return value. It prints the output of micss

Examples

set.seed(2)
e <- c(stats::rnorm(200),3*stats::rnorm(200))
o <- micss(e)
print.micss(o)

Whitening

Description

Eliminates the autocorrelation of a variable using an AR model.

Usage

whitening(y, kmax = NULL)

Arguments

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)].

Details

Selects the model using the Bayes Information Criterium.

Value

  • e: Whiten variable.

  • rho: Vector of autoregressive parameters.

  • lag: number of lags used.

Examples

whitening(rnorm(100))