Package 'NonlinearTSA'

Title: Nonlinear Time Series Analysis
Description: Function and data sets in the book entitled "Nonlinear Time Series Analysis with R Applications" B.Guris (2020). The book will be published in Turkish and the original name of this book will be "R Uygulamali Dogrusal Olmayan Zaman Serileri Analizi". It is possible to perform nonlinearity tests, nonlinear unit root tests, nonlinear cointegration tests and estimate nonlinear error correction models by using the functions written in this package. The Momentum Threshold Autoregressive (MTAR), the Smooth Threshold Autoregressive (STAR) and the Self Exciting Threshold Autoregressive (SETAR) type unit root tests can be performed using the functions written. In addition, cointegration tests using the Momentum Threshold Autoregressive (MTAR), the Smooth Threshold Autoregressive (STAR) and the Self Exciting Threshold Autoregressive (SETAR) models can be applied. It is possible to estimate nonlinear error correction models. The Granger causality test performed using nonlinear models can also be applied.
Authors: Burak Guris <[email protected]>
Maintainer: Burak Guris <[email protected]>
License: GPL (>= 2)
Version: 0.5.0
Built: 2024-12-11 07:11:59 UTC
Source: CRAN

Help Index


ARCH Test for time series

Description

This function allows you to make ARCH Test for residuals

Usage

ARCH.Test(x, lags)

Arguments

x

residual series name,

lags

lags

Examples

set.seed(12345)
x <- rnorm(1000)
ARCH.Test(x,3)

Cook and Vougas(2009) nonlinear unit root test function

Description

This function allows you to make Cook and Vougas(2009) nonlinear unit root test

Usage

Cook_Vougas_2009_unit_root(x, model, max_lags)

Arguments

x

series name,

model

if model A 1, if model B 2, if model C 3, model D 4

max_lags

maximum lag(optimal lag selected by AIC)

Examples

set.seed(12345)
x <- rnorm(1000)
Cook_Vougas_2009_unit_root(x,model=1,max_lags=3)

data(IBM)
Cook_Vougas_2009_unit_root(x=IBM,model=3,max_lags=3)

Cuestas and Garratt(2011) nonlinear unit root test function

Description

This function allows you to make Cuestas and Garratt(2011) nonlinear unit root test

Usage

Cuestas_Garratt_unit_root(x, max_lags, lsm)

Arguments

x

series name,

max_lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

Model Estimated model

Selected lag the lag order

Test Statistic the value of the test statistic

CV Critical Values

References

Cuestas, J. C., & Garratt, D. (2011). Is real GDP per capita a stationary process? Smooth transitions, nonlinear trends and unit root testing. Empirical Economics, 41(3), 555-563.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Cuestas_Garratt_unit_root(x,max_lags=6,lsm=3)

y <- cumsum(rnorm(1000))
Cuestas_Garratt_unit_root(y,max_lags=12,lsm=2)

data(IBM)
Cuestas_Garratt_unit_root(IBM,max_lags=3,lsm=1)

Cuestas and Ordonez(2014) nonlinear unit root test function

Description

This function allows you to make Cuestas and Ordonez(2014) nonlinear unit root test

Usage

Cuestas_Ordonez_2014_unit_root(x, max_lags)

Arguments

x

series name,

max_lags

maximum lag selected lag is determined by AIC

Value

"model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Cuestas, J. C., & Ordóñez, J. (2014). Smooth transitions, asymmetric adjustment and unit roots. Applied Economics Letters, 21(14), 969-972.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Cuestas_Ordonez_2014_unit_root(x, max_lags = 6)

y <- cumsum(rnorm(1000))
Cuestas_Ordonez_2014_unit_root(y, max_lags = 8)

data(IBM)
Cuestas_Ordonez_2014_unit_root(IBM, max_lags = 20)

Enders and Granger_1998 nonlinear unit root test function

Description

This function allows you to make Enders and Granger(1998) nonlinear unit root test for MTAR model

Usage

Enders_Granger_1998(x, case, max_lags, lsm)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

max_lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC

Value

"Model" Estimated model

"Selected lag" the lag order

"p1=p2=0 Statistic" the value of the test statistic

"p1=p2 statistic" the value of the test statistic

"prob." the probability of test statistic

References

Enders, W., & Granger, C. W. J. (1998). Unit-root tests and asymmetric adjustment with an example using the term structure of interest rates. Journal of Business & Economic Statistics, 16(3), 304-311.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Enders_Granger_1998(x, case = 1, max_lags = 6, lsm = 1)

y <- cumsum(rnorm(1000))
Enders_Granger_1998(y, 2, 8, 2)

data(IBM)
Enders_Granger_1998(IBM,case = 2,max_lags = 12,lsm = 2 )

Enders and Siklos(2001) Nonlinear Cointegration Test Function

Description

This function allows you to make Enders and Siklos(2001) nonlinear cointegration test

Usage

Enders_Siklos_2001(y, x, case = 2, max_lags)

Arguments

y

series name

x

series name,

case

if no lag 1, if one lag 2, if four lag 3, default case=2

max_lags

maximum lag (Apropriate lag is selected by Akaike Information Criteria)

Value

"Model" Estimated model

"Selected Lag" the lag order

"p1=p2=0 Statistic" the value of the test statistic

"p1=p2 Statistic" the value of the test statistic

"p value" the probability of test statistic

References

Enders, W., & Siklos, P. L. (2001). Cointegration and threshold adjustment. Journal of Business & Economic Statistics, 19(2), 166-176.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- cumsum(rnorm(1000))
y <- cumsum(rnorm(1000))
Enders_Siklos_2001(x, y, max_lags = 6)

data(MarketPrices)
Enders_Siklos_2001(MarketPrices[,1],MarketPrices[,2], max_lags = 12)

STAR Vector Error Correction Model

Description

This function allows you to estimate ESTAR Vector Error Correction Model

Usage

ESTAR_ECM(y, x, lags)

Arguments

y

series name,

x

series name

lags

lag length

Details

Exponential smooth transition error correction model as follows:

Value

"Model" Estimated model

"AIC" Akaike information criteria

"BIC" Schwarz information criteria

References

Kapetanios, G., Shin, Y., & Snell, A. (2006). Testing for cointegration in nonlinear smooth transition error correction models. Econometric Theory, 22(2), 279-303.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- cumsum(rnorm(1000))
y <- cumsum(rnorm(1000))
ESTAR_ECM(x, y, lags = 6)

data(MarketPrices)
ESTAR_ECM(MarketPrices[,1],MarketPrices[,2],lags = 2)

Harvey and Mills(2002) nonlinear unit root test function

Description

This function allows you to make Harvey and Mills(2002) nonlinear unit root test

Usage

Harvey_Mills_2002_unit_root(x, model, max_lags, lsm)

Arguments

x

series name,

model

if model with intercept 1, if model with trend 2 if model with trend*function 3,

max_lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC

Value

"Model" Estimated model

"Selected Lag" the lag order

"Test Statistic" the value of the test statistic

References

Harvey, D. I., & Mills, T. C. (2002). Unit roots and double smooth transitions. Journal of Applied Statistics, 29(5), 675-683.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Harvey_Mills_2002_unit_root(x, model = 1, max_lags = 6, lsm = 2)

y <- cumsum(rnorm(1000))
Harvey_Mills_2002_unit_root(y, 3, 9, 1)

data(IBM)
Harvey_Mills_2002_unit_root(x = IBM, model = 2, max_lags = 12, lsm = 1)

Hu and Chen(2016) nonlinear unit root test function

Description

This function allows you to make Hu and Chen(2016) nonlinear unit root test

Usage

Hu_Chen_Unit_Root(x, case, lags, lsm)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Hu, J., & Chen, Z. (2016). A unit root test against globally stationary ESTAR models when local condition is non-stationary. Economics letters, 146, 89-94.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Hu_Chen_Unit_Root(x, case = 1, lags = 6, lsm = 3)

y <- cumsum(rnorm(1000))
Hu_Chen_Unit_Root(y, 1, 3, 2)

data(IBM)
Hu_Chen_Unit_Root(IBM, case = 2,lags = 12, lsm = 2)

IBM

Description

Daily time series data between 01.01.2010 - 01.01.2018

Usage

IBM

Format

A data frame containing :

Price IBM Close Price

Source

Yahoo Finance

Examples

summary(IBM)

Kilic(2011) nonlinear unit root test function

Description

This function allows you to make Kilic(2011) nonlinear unit root test

Usage

Kilic_2011_unit_root(x, case, max_lags)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

max_lags

maximum lag apropriate lag length is selected by Akaike Information Criteria

Value

"Model" Estimated model

"Selected Lag" the lag order

"Test statistic" the value of the test statistic

References

Kılıç, R. (2011). Testing for a unit root in a stationary ESTAR process. Econometric Reviews, 30(3), 274-302.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(100)
Kilic_2011_unit_root(x,1,3)

data(IBM)
Kilic_2011_unit_root(IBM, case = 3, max_lags = 12)

Kruse(2011) nonlinear unit root test function

Description

This function allows you to make Kruse(2011) nonlinear unit root test

Usage

Kruse_Unit_Root(x, case, lags, lsm)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Kruse, R. (2011). A new unit root test against ESTAR based on a class of modified statistics. Statistical Papers, 52(1), 71-85.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Kruse_Unit_Root(x, case = 1, lags = 6, lsm =1)


y <- cumsum(rnorm(1000))
Kruse_Unit_Root(y, 3, 3, 3)


data(IBM)
Kruse_Unit_Root(IBM,case = 2,lags = 12,lsm = 2)

Kapetanios, Shin and Snell(2006) nonlinear cointegration test function

Description

This function allows you to make Kapetanios, Shin and Snell(2006) nonlinear cointegration test using residual based approach

Usage

KSS_2006_Cointegration(y, x, case, lags, lsm)

Arguments

y

series name,

x

series name

case

if raw data 1 if demeaned data 2 if detrended data 3,

lags

lag length

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Kapetanios, G., Shin, Y., & Snell, A. (2006). Testing for cointegration in nonlinear smooth transition error correction models. Econometric Theory, 22(2), 279-303.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- cumsum(rnorm(1000))
y <- cumsum(rnorm(1000))
KSS_2006_Cointegration(x, y, case = 1, lags = 6, lsm = 3)


KSS_2006_Cointegration(MarketPrices[,1],MarketPrices[,2], case = 1, lags = 2, lsm = 1)

Kapetanios, Shin and Snell(2003) nonlinear unit root test function

Description

This function allows you to make Kapetanios, Shin and Snell(2003) nonlinear unit root test

Usage

KSS_Unit_Root(x, case, lags, lsm)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Kapetanios, G., Shin, Y., & Snell, A. (2003). Testing for a unit root in the nonlinear STAR framework. Journal of econometrics, 112(2), 359-379.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
KSS_Unit_Root(x, case = 1, lags = 6, lsm =1)


y <- cumsum(rnorm(1000))
KSS_Unit_Root(y, 1, 3, 3)


data(IBM)
KSS_Unit_Root(IBM,case = 1,lags = 20,lsm = 3)

Leybourne Newbold and Vougas (1998) nonlinear unit root test function

Description

This function allows you to make Leybourne, Newbold and Vougas (1998) nonlinear unit root test

Usage

LNV_1998_unit_root(x, model, max_lags, lsm)

Arguments

x

series name,

model

if model with intercept 1, if model with trend 2 if model with trend*function 3,

max_lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC

Value

"Model" Estimated model

"Selected Lag" the lag order

"Test Statistic" the value of the test statistic

References

Leybourne, S., Newbold, P., & Vougas, D. (1998). Unit roots and smooth transitions. Journal of time series analysis, 19(1), 83-97.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
LNV_1998_unit_root(x, model = 1, max_lags = 6, lsm = 2)


y <- cumsum(rnorm(1000))
LNV_1998_unit_root(y, 3,  3, lsm = 1)


data(IBM)
LNV_1998_unit_root(x = IBM, model=2,max_lags = 10, lsm = 1)

MarketPrices

Description

Daily time series data between 01.01.2014-01.01.2019

Usage

MarketPrices

Format

A data frame containing :

FCHI CAC 40 Paris Stock Exchange Prices

IBEX Madrid Stock Exchange Prices

Source

Yahoo Finance

Examples

summary(MarketPrices)

Mc.Leod.Li nonlinearity test

Description

This function allows you to make Mc.Leod.Li nonlinearity test

Usage

Mc.Leod.Li(y, lag)

Arguments

y

series name,

lag

lag parameter,

Value

"lag stat pvalue" the lag order, the value of the test statistic and the probability of test statistic, respectively.

References

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Mc.Leod.Li(x, 10)


data(IBM)
Mc.Leod.Li(IBM,4)

MTAR Vector Error Correction Model

Description

This function allows you to estimate MTAR Vector Error Correction Model with threshold=0

Usage

MTAR_ECM(y, x, lags)

Arguments

y

series name,

x

series name

lags

lag length

Value

"Model" Estimated model

"AIC" Akaike information criteria

"BIC" Schwarz information criteria

References

Enders, W., & Siklos, P. L. (2001). Cointegration and threshold adjustment. Journal of Business & Economic Statistics, 19(2), 166-176.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- cumsum(rnorm(1000))
y <- cumsum(rnorm(1000))
MTAR_ECM(x, y, lags = 6)

data(MarketPrices)
MTAR_ECM(MarketPrices[,1],MarketPrices[,2],lags = 2)

Park and Shintani(2012) nonlinear unit root test function

Description

This function allows you to make Park and Shintani(2012) nonlinear unit root test

Usage

Park_Shintani_2016_unit_root(x, max_lags)

Arguments

x

series name,

max_lags

maximum lag (Apropriate lag is selected by Akaike Information Criteria)

Value

"Model" Estimated model

"Selected Lag" the lag order

"Test statistic" the value of the test statistic

References

Park, J. Y., & Shintani, M. (2016). Testing for a unit root against transitional autoregressive models. International Economic Review, 57(2), 635-664.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(50)
Park_Shintani_2016_unit_root(x, max_lags = 1)

data(IBM)
Park_Shintani_2016_unit_root(IBM, max_lags = 12)

Pascalau(2007) nonlinear unit root test function

Description

This function allows you to make Pascalau(2007) nonlinear unit root test

Usage

Pascalau_2007_unit_root(x, case, max_lags, lsm)

Arguments

x

series name,

case

if raw data 1, if demeaned data 2, if detrended data 3

max_lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC

Value

"Model" Estimated model

"Selected lag" the lag order

"Test statistic" the value of the test statistic

References

Pascalau, R. (2007). Testing for a unit root in the asymmetric nonlinear smooth transition framework. Department of Economics, Finance and Legal Studies University of Alabama Unpublished manuscript.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Pascalau_2007_unit_root(x, case = 1, max_lags = 6, lsm = 2)


y <- cumsum(rnorm(1000))
Pascalau_2007_unit_root(y, 2, 4, 1)


data(IBM)
Pascalau_2007_unit_root(x = IBM, case = 3, max_lags = 3, lsm = 1)

SETAR model estimation

Description

This function allows you to estimate SETAR model

Usage

SETAR_model(y, delay_order, lag_length, trim_value)

Arguments

y

series name,

delay_order

Delay order,

lag_length

lag length

trim_value

trimmed value, .15, .10, .5

Value

"Model" Estimated model

"threshold" the value of threshold

References

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(100)
SETAR_model(x, 1, 12, .15)


data(IBM)
SETAR_model(IBM, 1, 12, .05)

Sollis(2004) nonlinear unit root test function

Description

This function allows you to make Sollis(2004) nonlinear unit root test

Usage

Sollis_2004_unit_root(x, model, max_lags)

Arguments

x

series name,

model

if model with intercept 1, if model with trend 2 if model with trend*function 3

max_lags

maximum lag(optimal lag selected by AIC)

Value

"Model" Estimated model

"Selected lag" the lag order

"p1=p2=0 Statistic" the value of the test statistic

References

Sollis, R. (2004). Asymmetric adjustment and smooth transitions: a combination of some unit root tests. Journal of time series analysis, 25(3), 409-417.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

set.seed(123)
x <- rnorm(1000)
Sollis_2004_unit_root(x, model = 1, max_lags = 6)


set.seed(123)
y <- cumsum(rnorm(1000))
Sollis_2004_unit_root(y, 2, 12)


data(IBM)
Sollis_2004_unit_root(x = IBM, model = 3, max_lags = 3)

Sollis(2009) nonlinear unit root test function

Description

This function allows you to make Sollis(2009) nonlinear unit root test

Usage

Sollis2009_Unit_Root(x, case, lags, lsm)

Arguments

x

series name,

case

if raw data 1 if demeaned data 2 if detrended data 3,

lags

maximum lag

lsm

lag selection methods if 1 AIC, if 2 BIC, if 3 t-stat significance

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Sollis, R. (2009). A simple unit root test against asymmetric STAR nonlinearity with an application to real exchange rates in Nordic countries. Economic modelling, 26(1), 118-125.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Sollis2009_Unit_Root(x, case = 1, lags = 6, lsm = 3)


y <- cumsum(rnorm(1000))
Sollis2009_Unit_Root(y, 3, 8, 1)


data(IBM)
Sollis2009_Unit_Root(IBM,case = 2,lags = 12,lsm = 2)

Terasvirta (1994) nonlinearity test

Description

This function allows you to make Terasvirta (1994) nonlinearity test

Usage

Terasvirta1994test(x, d, maxp)

Arguments

x

series name,

d

delay parameter,

maxp

maximum p

Value

"Linearity" the value of the test statistic and the probability of the test statistic

"H01" the value of the test statistic and the probability of the test statistic

"H02" the value of the test statistic and the probability of the test statistic

"H03" the value of the test statistic and the probability of the test statistic

"H12" the value of the test statistic and the probability of the test statistic

References

Teräsvirta, T. (1994). Specification, estimation, and evaluation of smooth transition autoregressive models. Journal of the american Statistical association, 89(425), 208-218.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

x <- rnorm(1000)
Terasvirta1994test(x, 3, 4)


data(IBM)
Terasvirta1994test(IBM, 4, 4)

Vougas(2006) nonlinear unit root test function

Description

This function allows you to make Vougas(2006) nonlinear unit root test

Usage

Vougas_2006_unit_root(x, model, max_lags)

Arguments

x

series name,

model

if model A 1, if model B 2, if model C 3, model D 4, model E 5

max_lags

maximum lag(optimal lag selected by AIC)

Value

"Model" Estimated model

"Selected lag" the lag order

"Test Statistic" the value of the test statistic

References

Vougas, D. V. (2006). On unit root testing with smooth transitions. Computational statistics & data analysis, 51(2), 797-800.

Burak Guris, R Uygulamalı Dogrusal Olmayan Zaman Serileri Analizi, DER Yayinevi, 2020.

Examples

set.seed(12345)
x <- rnorm(1000)
Vougas_2006_unit_root(x, model = 1, max_lags = 6)

set.seed(12345)
y <- cumsum(rnorm(1000))
Vougas_2006_unit_root(x = y ,model = 2, max_lags = 9)


data(IBM)
Vougas_2006_unit_root(x = IBM, model = 3, max_lags = 3)