Type: | Package |
Title: | White Noise and Goodness-of-Fit Tests for Functional Time Series |
Version: | 1.0.0 |
Maintainer: | Mihyun Kim <mihyun.kim@mail.wvu.edu> |
Description: | It offers comprehensive tools for the analysis of functional time series data, focusing on white noise hypothesis testing and goodness-of-fit evaluations, alongside functions for simulating data and advanced visualization techniques, such as 3D rainbow plots. These methods are described in Kokoszka, Rice, and Shang (2017) <doi:10.1016/j.jmva.2017.08.004>, Yeh, Rice, and Dubin (2023) <doi:10.1214/23-EJS2112>, Kim, Kokoszka, and Rice (2023) <doi:10.1214/23-ss143>, and Rice, Wirjanto, and Zhao (2020) <doi:10.1111/jtsa.12532>. |
License: | GPL-3 |
Encoding: | UTF-8 |
Depends: | R (≥ 3.5.0) |
Imports: | sde, graphics, stats, rgl, fda, nloptr, sfsmisc, MASS |
RoxygenNote: | 7.3.2 |
Language: | en-US |
URL: | https://github.com/veritasmih/FTSgof |
BugReports: | https://github.com/veritasmih/FTSgof/issues |
Config/testthat/edition: | 3 |
SystemRequirements: | XQuartz (https://www.xquartz.org/) |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
NeedsCompilation: | no |
Packaged: | 2024-10-02 20:49:12 UTC; mk00095 |
Author: | Mihyun Kim [aut, cre],
Chi-Kuang Yeh |
VignetteBuilder: | knitr |
Repository: | CRAN |
Date/Publication: | 2024-10-03 19:30:08 UTC |
Daily Eurodollar Futures Curves
Description
This dataset contains daily Eurodollar futures curves from February 9, 1998 to June 5, 1998 (N=82
).
A Eurodollar futures contract represents an obligation to deliver 1,000,000 USD to a bank
outside the United States at a specified time.
The Eurodollar futures curves consist of daily settlement prices for these contracts,
available at monthly delivery dates for the first six months and quarterly delivery dates
up to 10 years into the future. These curves are preprocessed using cubic splines,
following Kargin and Onatski (2008), to transform the raw data into smooth curves on
a grid of 114 equally spaced points (J=114
).
Usage
data(EF)
Format
A matrix with columns representing the daily settlement prices as observed functions.
References
Kargin V, Onatski A (2008). Curve forecasting by functional autoregression. Journal of Multivariate Analysis, 99, 2508–2526.
Convert Original Price Data to OCIDRs
Description
This function converts original price data into over-night cumulative intraday return curves (OCIDRs).
Usage
OCIDR(f_data)
Arguments
f_data |
A |
Value
A matrix of OCIDRs with dimensions J \times (N-1)
, where J
is the number of discrete grid points and N-1
is the adjusted sample size.
Examples
data(sp500)
OCIDR(sp500)
Spanish electricity daily price profiles
Description
This dataset contains daily electricity price profiles from the Day-Ahead Spanish Electricity Market. The original data consists of hourly electricity spot prices, which have been transformed into daily functional profiles. The dataset covers the period from January 1, 2014, to December 31, 2014.
Usage
data(Spanish_elec)
Format
A matrix with rows representing hourly time points and columns representing the daily price profiles as observed functions.
Source
fdaACF
, https://www.esios.ree.es/es/analisis/600
FAR(p) Data Generator
Description
It generates functional data that follows a functional autoregressive process of order p
, denoted as FAR(p). The generated data consists of curves evaluated at discrete grid points.
Usage
dgp.far(J, N, S = 0.5, p = 1, kernel = "Gaussian", burn_in = 50)
Arguments
J |
The number of grid points for each curve observation. |
N |
The sample size, representing the number of curves to be generated. |
S |
The serial dependence factor for the kernel used in the FAR(p) process. Default is 0.5. |
p |
The order of the autoregressive process. Default is 1. |
kernel |
The type of kernel function |
burn_in |
The number of initial points discarded to eliminate transient effects. Default is 50. |
Details
The functional autoregressive model of order p
is given by:
X_i(t) -\mu(t) = \sum_{j=1}^{p} \Psi(X_{i-j}-\mu)(t) + \epsilon_i(t),
where \Psi(X)(t) = \int \psi(t,s)X(s) dt
is the kernel operator, and \epsilon_i(t)
are i.i.d. errors generated from a standard Brownian motion process.
The mean function \mu
is assumed to be zero in the generating process.
Value
A J \times N
matrix where each column contains a curve evaluated at J
grid points, generated from the FAR(p) model.
Examples
# Generate discrete evaluations of 200 curves, each observed at 50 grid points.
yd_far = dgp.far(J = 50, N = 200, S = 0.7, p = 2, kernel = "Gaussian", burn_in = 50)
Functional ARCH/GARCH Process Generator
Description
It generates functional curve data following the functional ARCH(1) or GARCH(1,1) process.
Usage
dgp.fgarch(J, N, type, alpha_par = NULL, beta_par = NULL)
Arguments
J |
The number of grid point in each curve observation. |
N |
The sample size. |
type |
A string to switch data generating process between "arch" - functional ARCH and "garch" - functional GARCH. |
alpha_par |
The ARCH kernel coefficient function in the conditional volatility equation. If it is missing, " |
beta_par |
The GARCH kernel coefficient function in the conditional volatility equation. If it is missing, " |
Details
If X_i(t)
follows an FARCH(1) process,
X_i(t)=\sigma_i(t)\varepsilon_i(t)
, t \in [0,1]
,
\sigma_i^2(t)=\omega(t)+\int \alpha(t,s) X^2_{i-1}(s)ds
.
If X_i(t)
follows an FGARCH(1,1) process,
X_i(t)=\sigma_i(t)\varepsilon_i(t)
, t \in [0,1]
,
\sigma_i^2(t)=\omega(t)+\int \alpha(t,s) X^2_{i-1}(s)ds+\int \beta(t,s) \sigma^2_{i-1}(s)ds
,
where the innovation \varepsilon_i(t)
follows an Ornstein–Uhlenbeck process dgp.ou
, and the constant coefficient \omega(t)=0.1t(1-t)
.
Value
List of generated processes:
garch_mat: FARCH/GARCH sequences, where the finite realization of curves are stored in columns;
sigma_mat: Conditional volatility sequences, where the finite realization of curves are stored in columns.
References
[1] Hormann, S., Horvath, L., Reeder, R. (2013). A functional version of the ARCH model. Econometric Theory. 29(2), 267-288. <doi:10.1017/S0266466612000345>.
[2] Aue, A., Horvath, L., F. Pellatt, D. (2017). Functional generalized autoregressive conditional heteroskedasticity. Journal of Time Series Analysis. 38(1), 3-21. <doi:10.1111/jtsa.12192>.
See Also
Examples
# Generate discrete evaluations of 100 fGARCH curves that
# each curve is realized on 50 grid points.
yd = dgp.fgarch(J = 50, N = 100, type = "garch")
yd_garch = yd$garch_mat
Ornstein–Uhlenbeck Process Generator
Description
It generates iid functional curve data following the Ornstein–Uhlenbeck process.
Usage
dgp.ou(J, N)
Arguments
J |
The number of grid points in each curve observation. |
N |
The sample size. |
Details
The Ornstein–Uhlenbeck process is given by:
x_i(t)=e^{-t/2}W_i(e^t)
, t \in [0,1]
,
where W_i(t)
is a standard Brownian Motion.
Value
A (grid points) x (number of observations) matrix for iid sequences, where the finite realization of curves are stored in columns.
Examples
# Generate discrete evaluations of 100 iid curves
# that each curve is realized on 50 grid points.
yd_ou = dgp.ou(J = 50, N = 100)
Functional Autocorrelation Function (fACF) Plot
Description
This function provides a graphical summary of the fACF of a functional time series (FTS) across different time lags h = 1:H
.
It also plots the 100 (1-\alpha)\%
confidence bounds, developed under both weak white noise (WWN) and strong white noise (SWN) assumptions for all lags h = 1:H
.
Usage
fACF(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
Arguments
f_data |
A |
H |
A positive integer value. The maximum lag for which to compute the coefficients and confidence bounds. |
alpha |
A numeric value between 0 and 1 specifying the significance level to be used for the confidence bounds. |
wwn_bound |
A Boolean value allowing the user to turn on the WWN bound. FALSE by default. Speeds down computation when TRUE. |
M |
A positive integer value. The number of Monte-Carlo simulations used to compute the confidence bounds under the WWN assumption.
If |
Details
This function computes and plots functional autocorrelation coefficients at lag h
, for h \in 1:H
. Given functional observations, X_1,\ldots, X_N
, the sample autocovariance kernel at lag h
can be computed by
\hat{\gamma}_{N,h}(t,s)=\frac{1}{N}\sum_{i=1}^{N-h} (X_i(t)-\bar{X}_N(t))(X_{i+h}(s)-\bar{X}_N(s)),\ \ \ \ 0 \le h < N,
where \bar{X}_N(t) = \frac{1}{N} \sum_{i=1}^N X_i(t)
. Then, the fACF at lag h
is defined by measuring
the magnitude (L^2
-norm) of the lagged autocovariance kernel \hat\gamma_{N,h}
:
\hat\rho_h =\frac{\|\hat{\gamma}_{N,h}\|}{\int \hat{\gamma}_{N,0}(t,t)dt}, \ \ \ \ \|\hat{\gamma}_{N,h}\|^2=\iint \hat{\gamma}_{N,h}^2(t,s) dtds.
This function plots estimated asymptotic 100 (1-\alpha)\%
confidence bounds under the WWN assumption.
Additionally, it computes similar (constant) bounds under the SWN assumption.
Value
Plot of the estimated functional autocorrelation coefficients for lags h \in 1:H
with the WWN
100 (1-\alpha)\%
upper confidence bound for each lag, as well as the constant SWN
100 (1-\alpha)\%
upper confidence bound.
References
[1] Kokoszka P., Rice G., Shang H.L. (2017). Inference for the autocovariance of a functional time series under conditional heteroscedasticity. Journal of Multivariate Analysis, 162, 32-50.
[2] Mestre G., Portela J., Rice G., Roque A. M. S., Alonso E. (2021). Functional time series model identification and diagnosis by means of auto-and partial autocorrelation analysis. Computational Statistics & Data Analysis, 155, 107108.
Examples
data(Spanish_elec) # Daily Spanish electricity price profiles
fACF(Spanish_elec)
fACF(Spanish_elec, H=10, wwn_bound=TRUE)
Test based on fACF
Description
This function performs a hypothesis test using a test statistic computed from functional autocovariance kernels of a FTS.
Usage
fACF_test(
f_data,
H = 10,
iid = FALSE,
M = NULL,
pplot = FALSE,
alpha = 0.05,
suppress_raw_output = FALSE,
suppress_print_output = FALSE
)
Arguments
f_data |
A |
H |
A positive integer specifying the maximum lag for which test statistic is computed. |
iid |
A Boolean value. If given TRUE, the hypothesis test will use the strong-white noise (SWN) assumption instead of the weak white noise (WWN) assumption. |
M |
A positive integer specifying the number of Monte Carlo simulations used to approximate the null distribution under the WWN assumption.
If |
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
alpha |
A numeric value between 0 and 1 indicating the significance level for the test. |
suppress_raw_output |
A Boolean value. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
A Boolean value. If TRUE, the function will not print any output to the console. |
Details
The test statistic is the sum of the squared L^2
-norm of the sample autocovariance kernels:
KRS_{N,H} = N \sum_{h=1}^H \|\hat{\gamma}_{N,h}\|^2,
where
\hat{\gamma}_{N,h}(t,s)=N^{-1}\sum_{i=1}^{N-h} (X_i(t)-\bar{X}_N(t))(X_{i+h}(s)-\bar{X}_N(s))
,
\bar{X}_N(t) = N^{-1} \sum_{i=1}^N X_i(t)
.
This test assesses the cumulative significance of lagged autocovariance kernels, up to a
user-selected maximum lag H
. A higher value of KRS_{N,H}
suggests a potential
departure of the observed series from white noise process. The approximated null
distribution of this statistic is developed under both the strong and weak white noise assumptions.
Value
If suppress_raw_output = FALSE, a list that includes the test statistic, the (1-\alpha)
quantile of the
limiting distribution, and the p-value from the specified hypothesis test. Additionally, if suppress_print_output = FALSE,
a summary is printed with a brief explanation of the test, the p-value, and relevant details about the test procedure.
References
[1] Kokoszka P., Rice G., Shang H.L. (2017). Inference for the autocovariance of a functional time series under conditional heteroscedasticity. Journal of Multivariate Analysis, 162, 32-50.
Examples
data(sp500) # S&P500 index
fACF_test(OCIDR(sp500), H = 10, pplot=TRUE)
Test for Conditional Heteroscedasticity of Functional Time Series
Description
It tests the null hypothesis that the objective functional curve data is not conditionally heteroscedastic. If a small p-value rejects the null hypothesis, the curves exhibit conditional heteroscedasticity.
Usage
fCH_test(f_data, H = 10, stat_Method = "functional", pplot = FALSE)
Arguments
f_data |
A |
H |
A positive integer specifying the maximum lag for which test statistic is computed. |
stat_Method |
A string specifying the test method to be used in the "ch" test. Options include:
|
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
Details
Given the objective curve data X_i(t)
, for 1\leq i \leq N
, t\in[0,1]
, the test aims at distinguishing the hypotheses:
H_0
: the sequence X_i(t)
is IID;
H_1
: the sequence X_i(t)
is conditionally heteroscedastic.
Two portmanteau type statistics are applied:
1. the norm-based statistic: V_{N,H}=N\sum_{h=1}^H\hat{\gamma}^2_{X^2}(h)
, where \hat{\gamma}^2_{X^2}(h)
is the sample autocorrelation of the time series ||X_1||^2,\dots,||X_N||^2
, and H
is a pre-set maximum lag length.
2. the fully functional statistic M_{N,H}=N\sum_{h=1}^H||\hat{\gamma}_{X^2,N,h}||^2
, where the autocovariance kernel \hat{\gamma}_{X^2,N,h}(t,s)=N^{-1}\sum_{i=1}^{N-h}[X_i^2(t)-\bar{X}^2(t)][X^2_{i+h}(s)-\bar{X}(s)]
, for ||\cdot ||
is the L^2
norm, and \bar{X}^2(t)=N^{-1}\sum_{i=1}^N X^2_i(t)
.
Value
A list that includes the test statistic and the p-value will be returned.
References
Rice, G., Wirjanto, T., Zhao, Y. (2020). Tests for conditional heteroscedasticity of functional data. Journal of Time Series Analysis. 41(6), 733-758. <doi:10.1111/jtsa.12532>.
Examples
# generate discrete evaluations of the iid curves under the null hypothesis.
yd_ou = dgp.ou(50, 100)
# test the conditional heteroscedasticity.
fCH_test(yd_ou, H=5, stat_Method="functional")
Functional Spherical Autocorrelation Function (fSACF) Plot
Description
This function offers a graphical summary of the fSACF of a functional time series (FTS) across different time lags h = 1:H
.
It also plots 100 \times (1-\alpha)\%
confidence bounds developed under strong white noise (SWN) assumption for all lags h = 1:H
.
Usage
fSACF(f_data, H = 20, alpha = 0.05)
Arguments
f_data |
A |
H |
A positive integer value. The maximum lag for which to compute the coefficients and confidence bounds. |
alpha |
A numeric value between 0 and 1 specifying the significance level to be used for the confidence bounds. |
Details
This function computes and plots functional spherical autocorrelation coefficients at lag h
, for h = 1:H
.
The fSACF at lag h
is computed by the average of the inner product of lagged pairs of
the series X_i
and X_{i+h}
that have been centered and scaled:
\tilde\rho_h=\frac{1}{N}\sum_{i=1}^{N-h} \langle \frac{X_i - \tilde{\mu}}{\|X_i - \tilde{\mu}\|}, \frac{X_{i+h} - \tilde{\mu}}{\|X_{i+h} - \tilde{\mu}\|} \rangle,\ \ \ \ 0 \le h < N,
where \tilde{\mu}
is the estimated spatial median of the series.
It also computes estimated asymptotic (1-\alpha)100 \%
confidence lower and upper bounds, under the SWN assumption.
Value
Plot of the estimated autocorrelation coefficients for lags h
in 1:H
with the SWN
(1-\alpha)100 \%
upper and lower confidence bounds for each lag.
References
[1] Yeh C.K., Rice G., Dubin J.A. (2023). Functional spherical autocorrelation: A robust estimate of the autocorrelation of a functional time series. Electronic Journal of Statistics, 17, 650–687.
Examples
data(Spanish_elec) # Daily Spanish electricity price profiles
fSACF(Spanish_elec)
Test based on fSACF
Description
This function performs a hypothesis test using a test statistic computed from functional spherical autocorrelation coefficients of a FTS.
Usage
fSACF_test(
f_data,
H = 10,
alpha = 0.05,
pplot = FALSE,
suppress_raw_output = FALSE,
suppress_print_output = FALSE
)
Arguments
f_data |
A |
H |
A positive integer specifying the maximum lag for which test statistic is computed. |
alpha |
A numeric value between 0 and 1 indicating the significance level for the test. |
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
suppress_raw_output |
A Boolean value. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
A Boolean value. If TRUE, the function will not print any output to the console. |
Details
The test statistic is the sum of the squared L^2
-norm of the sample spherical autocorrelation coefficients:
S_{N,H} = N \sum_{h=1}^H \|\tilde{\rho}_{h}\|^2,
where \tilde\rho_h=\frac{1}{N}\sum_{i=1}^{N-h} \langle \frac{X_i - \tilde{\mu}}{\|X_i - \tilde{\mu}\|}, \frac{X_{i+h} - \tilde{\mu}}{\|X_{i+h} - \tilde{\mu}\|} \rangle
,
and \tilde{\mu}
is the estimated spatial median of the series.
This test assesses the cumulative significance of lagged spherical autocorrelation coefficients, up to a
user-selected maximum lag H
. A higher value of S_{N,H}
suggests a potential
departure of the observed series from white noise process. The approximated null
distribution of this statistic is developed under the strong white noise assumptions.
Value
If suppress_raw_output = FALSE, a list containing the test statistic, the (1-\alpha)
quantile of the
limiting distribution, and the p-value computed from the specified hypothesis test. Also prints output
containing a short description of the test, the p-value, and additional information about the test if
suppress_print_output = FALSE.
References
[1] Yeh CK, Rice G, Dubin JA (2023). “Functional spherical autocorrelation: A robust estimate of the autocorrelation of a functional time series.” Electronic Journal of Statistics, 17, 650–687.
Examples
data(Spanish_elec)
fACF_test(Spanish_elec, H = 20)
Exploratory Data Analysis for Functional Time Series.
Description
This function sequentially displays the fACF plot, the fSACF and the rainbow plot of a functional time series (FTS) for comprehensive exploratory data analysis.
Usage
fport_eda(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
Arguments
f_data |
A |
H |
A positive integer representing the maximum lag for computing the coefficients and confidence bounds. This value determines the range of lags included in the fACF and fSACF plots. |
alpha |
A numeric value between 0 and 1 indicating the significance level for the confidence bounds in the fACF and fSACF plots. |
wwn_bound |
A Boolean value allowing the user to turn on the WWN bound in the fACF plot. FALSE by default. Speeds down computation when TRUE. |
M |
A positive integer value. The number of Monte-Carlo simulations used to compute the confidence bounds under the WWN assumption.
If |
Details
This function sequentially displays the rainbow plot, the fACF plot, and the fSACF of an FTS for comprehensive exploratory data analysis.
See the help page of rainbow3D
, fACF
, fSACF
, for more details.
Value
A 3D rainbow plot, a fACF plot for lags h \in 1:H
with the WWN
(1-\alpha)100 \%
upper confidence bound and the constant strong white noise (SWN)
(1-\alpha)100 \%
upper confidence bound, and a fSACF plot for lags h \in 1:H
with the SWN
(1-\alpha)100 \%
upper and lower confidence bounds.
References
[1] Kokoszka P., Rice G., Shang H.L. (2017). Inference for the autocovariance of a functional time series under conditional heteroscedasticity. Journal of Multivariate Analysis, 162, 32-50.
[2] Mestre G., Portela J., Rice G., Roque A. M. S., Alonso E. (2021). Functional time series model identification and diagnosis by means of auto-and partial autocorrelation analysis. Computational Statistics & Data Analysis, 155, 107108.
[3] Yeh CK, Rice G, Dubin JA (2023). “Functional spherical autocorrelation: A robust estimate of the autocorrelation of a functional time series.” Electronic Journal of Statistics, 17, 650–687.
Examples
data(Spanish_elec) # Daily Spanish electricity price profiles
fport_eda(Spanish_elec)
Goodness-of-fit Tests for Functional Times Series
Description
It computes three different goodness-of-fit tests for functional time series. All goodness-of-fit tests in this package are accessible through this function.
Usage
fport_gof(
f_data,
test = "far",
H = 10,
M = NULL,
pplot = FALSE,
residual = FALSE
)
Arguments
f_data |
A |
test |
A string specifying the goodness-of-fit test. Currently available tests are referred to by their string handles: "far", "arch" and "garch". Please see the Details section of the documentation. |
H |
A positive integer specifying the maximum lag for which test statistics are computed. |
M |
A positive integer specifying the number of Monte Carlo simulations used to approximate the null distribution in the "far" test, and the number of basis functions used in the "arch" and "garch" tests.
If |
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
residual |
A data frame. If TRUE, the function will provide the residuals obtained from fitting the FAR(1) model. |
Details
This function conducts goodness-of-fit tests for functional time series data, providing several testing options:
1. When test = "far", it tests the goodness-of-fit of the FAR(1) model.
The function fits the FAR(1) model to the input data and then applies the test statistic KRS_{N,H}
, as described in fport_wn
, to the residuals.
The null distribution of the test statistic accounts for the dependence structure present in the residuals.
The optional parameters for this test are 'fdata', 'test', 'H', 'M', 'pplot' and 'residual'.
2. When test = "arch" or "garch", it tests the goodness-of-fit of the fARCH(1) or fGARCH(1,1) models.
It fits the model to the input data and applies the test M_{N,H}
in fport_wn
to the model residuals.
The asymptotic distribution is adjusted to account for the estimation effect,
because the model residual depends on the joint asymptotics of the innovation process and
the estimated parameters. We assume that the kernel parameters are consistently estimated
by the Least Squares method proposed in Aue et al. (2017).
Then, the asymptotic distribution of the statistic M_{N,H}
is given in Theorem 3.1
in Rice et al. (2020).
The optional parameters for this test are 'fdata', 'test', 'H', 'M', and 'pplot'.
Value
A summary is printed with a brief explanation of the test and the p-value.
References
[1] Kim, M., Kokoszka, P., & Rice, G. (2023). White noise testing for functional time series. Statistic Surveys, 17, 119-168.
[2] Aue, A., Horvath, L., F. Pellatt, D. (2017). Functional generalized autoregressive conditional heteroskedasticity. Journal of Time Series Analysis. 38(1), 3-21. <doi:10.1111/jtsa.12192>.
[3] Rice, G., Wirjanto, T., Zhao, Y. (2020). Tests for conditional heteroscedasticity of functional data. Journal of Time Series Analysis. 41(6), 733-758. <doi:10.1111/jtsa.12532>.
Examples
data(Spanish_elec)
fport_gof(Spanish_elec, test = "far", H = 20, pplot=TRUE)
data(sp500)
fport_gof(OCIDR(sp500), test = "arch", M = 1, H = 5)
fport_gof(OCIDR(sp500), test = "garch", M = 1, H = 10)
White Noise Hypothesis Tests for Functional Times Series
Description
It computes a variety of white noise tests for functional times series (FTS) data. All white noise tests in this package are accessible through this function.
Usage
fport_wn(
f_data,
test = "autocovariance",
H = 10,
iid = FALSE,
M = NULL,
stat_Method = "functional",
pplot = FALSE
)
Arguments
f_data |
A |
test |
A string specifying the hypothesis test. Currently available tests are referred to by their string handles: "autocovariance", "spherical" and "ch". Please see the Details section of the documentation. |
H |
A positive integer specifying the maximum lag for which test statistics are computed. |
iid |
A Boolean value used in the "autocovariance" test. If given TRUE, the hypothesis test will use the strong-white noise (SWN) assumption instead of the weak white noise (WWN) assumption. |
M |
A positive integer specifying the number of Monte Carlo simulations used to approximate the null distribution in the "autocovariance" test under the WWN assumption.
If |
stat_Method |
A string specifying the test method to be used in the "ch" test. Options include:
|
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
Details
This function performs white noise hypothesis testing for functional time series (FTS) data. It offers several types of tests:
1. Test based on fACF (test = "autocovariance"):
This test evaluates the sum of the squared L^2
-norm of the sample autocovariance kernels:
KRS_{N,H} = N \sum_{h=1}^H \|\hat{\gamma}_{N,h}\|^2,
where
\hat{\gamma}_{N,h}(t,s)=\frac{1}{N}\sum_{i=1}^{N-h} (X_i(t)-\bar{X}_N(t))(X_{i+h}(s)-\bar{X}_N(s))
,
\bar{X}_N(t) = \frac{1}{N} \sum_{i=1}^N X_i(t)
It assesses the cumulative significance of lagged autocovariance kernels up to a user-specified maximum lag H
.
A higher value of KRS_{N,H}
suggests a potential departure from a white noise process.
The null distribution is approximated under both strong and weak white noise assumptions.
Optional parameters include 'f_data', 'test', 'H', 'iid', 'M', and 'pplot'.
2. Test based on fSACF (test = "spherical"):
This test evaluates the sum of the squared L^2
-norm of the sample spherical autocorrelation coefficients:
S_{N,H} = N \sum_{h=1}^H \|\tilde{\rho}_{h}\|^2,
where \tilde\rho_h=\frac{1}{N}\sum_{i=1}^{N-h} \langle \frac{X_i - \tilde{\mu}}{\|X_i - \tilde{\mu}\|}, \frac{X_{i+h} - \tilde{\mu}}{\|X_{i+h} - \tilde{\mu}\|} \rangle
,
and \tilde{\mu}
is the estimated spatial median of the series.
It assesses the cumulative significance of lagged spherical autocorrelation coefficients up to a user-specified maximum lag H
.
A higher value of S_{N,H}
suggests a potential departure from a white noise process.
The null distribution is approximated under strong white noise assumptions.
Optional parameters include 'f_data', 'test', 'H', and 'pplot'.
3. Test for Conditional Heteroscedasticity (test = "ch"): This test investigates whether the functional time series exhibits conditional heteroscedasticity. Two portmanteau-type statistics are used:
Norm-based statistic:
V_{N,H} = N \sum_{h=1}^H \hat{\gamma}^2_{X^2}(h)
, where\hat{\gamma}^2_{X^2}(h)
is the sample autocorrelation of the time series||X_1||^2, \dots, ||X_N||^2
, withH
as the maximum lag length.Fully functional statistic:
M_{N,H} = N \sum_{h=1}^H \|\hat{\gamma}_{X^2,N,h}\|^2
, where\hat{\gamma}_{X^2,N,h}(t,s) = \frac{1}{N} \sum_{i=1}^{N-h} [X_i^2(t) - \bar{X}^2(t)][X^2_{i+h}(s) - \bar{X}(s)]
, with\|\cdot\|
representing theL^2
norm and\bar{X}^2(t) = \frac{1}{N} \sum_{i=1}^N X_i^2(t)
.
Optional parameters for this test include 'f_data', 'test', 'H', 'stat_Method', and 'pplot'.
Value
A summary is printed with a brief explanation of the test and the p-value.
References
[1] Kokoszka P., Rice G., Shang H.L. (2017). Inference for the autocovariance of a functional time series under conditional heteroscedasticity. Journal of Multivariate Analysis, 162, 32-50.
[2] Yeh CK, Rice G, Dubin JA (2023). “Functional spherical autocorrelation: A robust estimate of the autocorrelation of a functional time series.” Electronic Journal of Statistics, 17, 650–687.
[3] Rice, G., Wirjanto, T., Zhao, Y. (2020). Tests for conditional heteroscedasticity of functional data. Journal of Time Series Analysis. 41(6), 733-758. <doi:10.1111/jtsa.12532>.
Examples
data(Spanish_elec)
fport_wn(Spanish_elec, test = "autocovariance", pplot = TRUE)
fport_wn(Spanish_elec, test = "spherical", H = 15, pplot = TRUE)
# generate fARCH(1)
yd_arch <- dgp.fgarch(J = 50, N = 200, type = "arch")$garch_mat
fport_wn(yd_arch, test = "ch", H = 20, stat_Method = "norm", pplot = TRUE)
fport_wn(yd_arch, test = "ch", H = 20, stat_Method = "functional", pplot = TRUE)
Goodness-of-fit Test for Functional ARCH/GARCH Model
Description
It tests the goodness-of-fit of functional ARCH/GARCH models by accounting for the effect of functional GARCH parameter estimation.
Usage
gof_fGARCH(f_data, M, model, H = 10, pplot = NULL, max_eval = 10000)
Arguments
f_data |
A |
M |
A positive integer specifying the number of basis functions. |
model |
A string to indicate which model will be estimated: "arch" - FARCH(1); "garch" - FGARCH(1,1). |
H |
A positive integer specifying the maximum lag for which test statistics are computed. |
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
max_eval |
The maximum number of evaluations of the optimization function, used in the "arch" and "garch" tests. |
Details
It tests the goodness-of-fit of the fARCH(1) or fGARCH(1,1) models.
It fits the model to the input data and applies the test M_{N,H}
in fport_wn
to the model residuals.
The asymptotic distribution is adjusted to account for the estimation effect,
because the model residual depends on the joint asymptotics of the innovation process and
the estimated parameters. We assume that the kernel parameters are consistently estimated
by the Least Squares method proposed in Aue et al. (2017).
Then, the asymptotic distribution of the statistic M_{N,H}
is given in Theorem 3.1
in Rice et al. (2020).
Value
p-value.
References
[1] Aue, A., Horvath, L., F. Pellatt, D. (2017). Functional generalized autoregressive conditional heteroskedasticity. Journal of Time Series Analysis. 38(1), 3-21. <doi:10.1111/jtsa.12192>.
[2] Rice, G., Wirjanto, T., Zhao, Y. (2020). Tests for conditional heteroscedasticity of functional data. Journal of Time Series Analysis. 41(6), 733-758. <doi:10.1111/jtsa.12532>.
Examples
# generate discrete evaluations of the FGARCH process.
set.seed(42)
yd = dgp.fgarch(J=50, N=200, type = "garch")$garch_mat
# test the adequacy of the FARCH(1) model.
gof_fGARCH(yd, M=2, model = "arch", H=10, pplot=TRUE)
Goodness-of-fit test for FAR(1)
Description
It fits a FAR(1) model and then assesses the cumulative significance of lagged
autocovariance operators from the model residuals, up to a user-selected maximum lag H
.
Usage
gof_far(
f_data,
H = 10,
M = NULL,
alpha = 0.05,
pplot = FALSE,
residual = FALSE,
suppress_raw_output = FALSE,
suppress_print_output = FALSE
)
Arguments
f_data |
A |
H |
A positive integer specifying the maximum lag for which test statistics are computed. |
M |
A positive integer specifying the number of Monte Carlo simulations used to approximate the null distribution.
If |
alpha |
A numeric value between 0 and 1 specifying the significance level. |
pplot |
A Boolean value. If TRUE, the function will produce a plot of p-values of the test
as a function of maximum lag |
residual |
A data frame. If TRUE, the function will provide the residuals obtained from fitting the FAR(1) model. |
suppress_raw_output |
A Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
A Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
Value
If suppress_raw_output = FALSE, a list containing the test statistic, the (1-\alpha)
quantile of the
limiting distribution, and the p-value computed from the specified hypothesis test. Also prints output
containing a short description of the test, the p-value, and additional information about the test if
suppress_print_output = FALSE.
References
[1] Kim, M., Kokoszka, P., & Rice, G. (2023). White noise testing for functional time series. Statistic Surveys, 17, 119-168.
Examples
yd_far <- dgp.far(J=50, N=100, S=0.7, p=2, kernel = "Gaussian", burn_in = 50)
gof_far(yd_far, H=5, pplot=TRUE)
3D Rainbow Plot for Functional Time Series
Description
This function creates a 3D rainbow plot of a functional time series (FTS) using the rgl
package.
The data is color-coded using a rainbow color scheme, with earlier curves in red and later curves in violet.
A 360-degree interactive view is available through an embedded widget.
Usage
rainbow3D(f_data)
Arguments
f_data |
A |
Value
A 3D rainbow plot of the functional time series data.
Examples
data(Spanish_elec) # Daily Spanish electricity price profiles
rainbow3D(Spanish_elec)
data(sp500) # S&P500 index data
rainbow3D(OCIDR(sp500))
S&P 500 Index Price Data
Description
This dataset contains S&P 500 index prices, given in percentages, for all full trading days between January 3, 2017 and January 2, 2018, observed at a 1-minute frequency (390 grid points per day).
Usage
data(sp500)
Format
A matrix with rows representing minute-by-minute time points and columns representing intraday prices.