Title: | White Noise and Goodness-of-Fit Tests for Functional Time Series |
---|---|
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>. |
Authors: | Mihyun Kim [aut, cre], Chi-Kuang Yeh [aut] , Yuqian Zhao [aut], Gregory Rice [ctb] |
Maintainer: | Mihyun Kim <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-11-06 05:45:14 UTC |
Source: | https://github.com/veritasmih/ftsgof |
It generates functional data that follows a functional autoregressive process of order , denoted as FAR(p). The generated data consists of curves evaluated at discrete grid points.
dgp.far(J, N, S = 0.5, p = 1, kernel = "Gaussian", burn_in = 50)
dgp.far(J, N, S = 0.5, p = 1, kernel = "Gaussian", burn_in = 50)
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. |
The functional autoregressive model of order is given by:
where is the kernel operator, and
are i.i.d. errors generated from a standard Brownian motion process.
The mean function
is assumed to be zero in the generating process.
A matrix where each column contains a curve evaluated at
grid points, generated from the FAR(p) model.
# 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)
# 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)
It generates functional curve data following the functional ARCH(1) or GARCH(1,1) process.
dgp.fgarch(J, N, type, alpha_par = NULL, beta_par = NULL)
dgp.fgarch(J, N, type, alpha_par = NULL, beta_par = NULL)
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, " |
If follows an FARCH(1) process,
,
,
.
If follows an FGARCH(1,1) process,
,
,
,
where the innovation follows an Ornstein–Uhlenbeck process
dgp.ou
, and the constant coefficient .
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.
[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>.
# 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
# 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
It generates iid functional curve data following the Ornstein–Uhlenbeck process.
dgp.ou(J, N)
dgp.ou(J, N)
J |
The number of grid points in each curve observation. |
N |
The sample size. |
The Ornstein–Uhlenbeck process is given by:
,
,
where is a standard Brownian Motion.
A (grid points) x (number of observations) matrix for iid sequences, where the finite realization of curves are stored in columns.
# Generate discrete evaluations of 100 iid curves # that each curve is realized on 50 grid points. yd_ou = dgp.ou(J = 50, N = 100)
# Generate discrete evaluations of 100 iid curves # that each curve is realized on 50 grid points. yd_ou = dgp.ou(J = 50, N = 100)
This dataset contains daily Eurodollar futures curves from February 9, 1998 to June 5, 1998 ().
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 (
).
data(EF)
data(EF)
A matrix with columns representing the daily settlement prices as observed functions.
Kargin V, Onatski A (2008). Curve forecasting by functional autoregression. Journal of Multivariate Analysis, 99, 2508–2526.
This function provides a graphical summary of the fACF of a functional time series (FTS) across different time lags .
It also plots the
confidence bounds, developed under both weak white noise (WWN) and strong white noise (SWN) assumptions for all lags
.
fACF(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
fACF(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
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 |
This function computes and plots functional autocorrelation coefficients at lag , for
. Given functional observations,
, the sample autocovariance kernel at lag
can be computed by
where . Then, the fACF at lag
is defined by measuring
the magnitude (
-norm) of the lagged autocovariance kernel
:
This function plots estimated asymptotic confidence bounds under the WWN assumption.
Additionally, it computes similar (constant) bounds under the SWN assumption.
Plot of the estimated functional autocorrelation coefficients for lags with the WWN
upper confidence bound for each lag, as well as the constant SWN
upper confidence bound.
[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.
data(Spanish_elec) # Daily Spanish electricity price profiles fACF(Spanish_elec) fACF(Spanish_elec, H=10, wwn_bound=TRUE)
data(Spanish_elec) # Daily Spanish electricity price profiles fACF(Spanish_elec) fACF(Spanish_elec, H=10, wwn_bound=TRUE)
This function performs a hypothesis test using a test statistic computed from functional autocovariance kernels of a FTS.
fACF_test( f_data, H = 10, iid = FALSE, M = NULL, pplot = FALSE, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
fACF_test( f_data, H = 10, iid = FALSE, M = NULL, pplot = FALSE, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
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. |
The test statistic is the sum of the squared -norm of the sample autocovariance kernels:
where
,
.
This test assesses the cumulative significance of lagged autocovariance kernels, up to a
user-selected maximum lag
. A higher value of
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.
If suppress_raw_output = FALSE, a list that includes the test statistic, the 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.
[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.
data(sp500) # S&P500 index fACF_test(OCIDR(sp500), H = 10, pplot=TRUE)
data(sp500) # S&P500 index fACF_test(OCIDR(sp500), H = 10, pplot=TRUE)
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.
fCH_test(f_data, H = 10, stat_Method = "functional", pplot = FALSE)
fCH_test(f_data, H = 10, stat_Method = "functional", pplot = FALSE)
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 |
Given the objective curve data , for
,
, the test aims at distinguishing the hypotheses:
: the sequence
is IID;
: the sequence
is conditionally heteroscedastic.
Two portmanteau type statistics are applied:
1. the norm-based statistic: , where
is the sample autocorrelation of the time series
, and
is a pre-set maximum lag length.
2. the fully functional statistic , where the autocovariance kernel
, for
is the
norm, and
.
A list that includes the test statistic and the p-value will be returned.
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>.
# 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")
# 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")
This function sequentially displays the fACF plot, the fSACF and the rainbow plot of a functional time series (FTS) for comprehensive exploratory data analysis.
fport_eda(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
fport_eda(f_data, H = 20, alpha = 0.05, wwn_bound = FALSE, M = NULL)
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 |
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.
A 3D rainbow plot, a fACF plot for lags with the WWN
upper confidence bound and the constant strong white noise (SWN)
upper confidence bound, and a fSACF plot for lags
with the SWN
upper and lower confidence bounds.
[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.
data(Spanish_elec) # Daily Spanish electricity price profiles fport_eda(Spanish_elec)
data(Spanish_elec) # Daily Spanish electricity price profiles fport_eda(Spanish_elec)
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.
fport_gof( f_data, test = "far", H = 10, M = NULL, pplot = FALSE, residual = FALSE )
fport_gof( f_data, test = "far", H = 10, M = NULL, pplot = FALSE, residual = FALSE )
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. |
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 , 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 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 is given in Theorem 3.1
in Rice et al. (2020).
The optional parameters for this test are 'fdata', 'test', 'H', 'M', and 'pplot'.
A summary is printed with a brief explanation of the test and the p-value.
[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>.
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)
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)
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.
fport_wn( f_data, test = "autocovariance", H = 10, iid = FALSE, M = NULL, stat_Method = "functional", pplot = FALSE )
fport_wn( f_data, test = "autocovariance", H = 10, iid = FALSE, M = NULL, stat_Method = "functional", pplot = FALSE )
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 |
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 -norm of the sample autocovariance kernels:
where
,
It assesses the cumulative significance of lagged autocovariance kernels up to a user-specified maximum lag
.
A higher value of
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 -norm of the sample spherical autocorrelation coefficients:
where ,
and
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
.
A higher value of
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: , where
is the sample autocorrelation of the time series
, with
as the maximum lag length.
Fully functional statistic: , where
, with
representing the
norm and
.
Optional parameters for this test include 'f_data', 'test', 'H', 'stat_Method', and 'pplot'.
A summary is printed with a brief explanation of the test and the p-value.
[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>.
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)
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)
This function offers a graphical summary of the fSACF of a functional time series (FTS) across different time lags .
It also plots
confidence bounds developed under strong white noise (SWN) assumption for all lags
.
fSACF(f_data, H = 20, alpha = 0.05)
fSACF(f_data, H = 20, alpha = 0.05)
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. |
This function computes and plots functional spherical autocorrelation coefficients at lag , for
.
The fSACF at lag
is computed by the average of the inner product of lagged pairs of
the series
and
that have been centered and scaled:
where is the estimated spatial median of the series.
It also computes estimated asymptotic
confidence lower and upper bounds, under the SWN assumption.
Plot of the estimated autocorrelation coefficients for lags in
with the SWN
upper and lower confidence bounds for each lag.
[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.
data(Spanish_elec) # Daily Spanish electricity price profiles fSACF(Spanish_elec)
data(Spanish_elec) # Daily Spanish electricity price profiles fSACF(Spanish_elec)
This function performs a hypothesis test using a test statistic computed from functional spherical autocorrelation coefficients of a FTS.
fSACF_test( f_data, H = 10, alpha = 0.05, pplot = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
fSACF_test( f_data, H = 10, alpha = 0.05, pplot = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
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. |
The test statistic is the sum of the squared -norm of the sample spherical autocorrelation coefficients:
where ,
and
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
. A higher value of
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.
If suppress_raw_output = FALSE, a list containing the test statistic, the 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.
[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.
data(Spanish_elec) fACF_test(Spanish_elec, H = 20)
data(Spanish_elec) fACF_test(Spanish_elec, H = 20)
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 .
gof_far( f_data, H = 10, M = NULL, alpha = 0.05, pplot = FALSE, residual = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
gof_far( f_data, H = 10, M = NULL, alpha = 0.05, pplot = FALSE, residual = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
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. |
If suppress_raw_output = FALSE, a list containing the test statistic, the 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.
[1] Kim, M., Kokoszka, P., & Rice, G. (2023). White noise testing for functional time series. Statistic Surveys, 17, 119-168.
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)
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)
It tests the goodness-of-fit of functional ARCH/GARCH models by accounting for the effect of functional GARCH parameter estimation.
gof_fGARCH(f_data, M, model, H = 10, pplot = NULL, max_eval = 10000)
gof_fGARCH(f_data, M, model, H = 10, pplot = NULL, max_eval = 10000)
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. |
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 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 is given in Theorem 3.1
in Rice et al. (2020).
p-value.
[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>.
# 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)
# 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)
This function converts original price data into over-night cumulative intraday return curves (OCIDRs).
OCIDR(f_data)
OCIDR(f_data)
f_data |
A |
A matrix of OCIDRs with dimensions , where
is the number of discrete grid points and
is the adjusted sample size.
data(sp500) OCIDR(sp500)
data(sp500) OCIDR(sp500)
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.
rainbow3D(f_data)
rainbow3D(f_data)
f_data |
A |
A 3D rainbow plot of the functional time series data.
data(Spanish_elec) # Daily Spanish electricity price profiles rainbow3D(Spanish_elec) data(sp500) # S&P500 index data rainbow3D(OCIDR(sp500))
data(Spanish_elec) # Daily Spanish electricity price profiles rainbow3D(Spanish_elec) data(sp500) # S&P500 index data rainbow3D(OCIDR(sp500))
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).
data(sp500)
data(sp500)
A matrix with rows representing minute-by-minute time points and columns representing intraday prices.
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.
data(Spanish_elec)
data(Spanish_elec)
A matrix with rows representing hourly time points and columns representing the daily price profiles as observed functions.
fdaACF
, https://www.esios.ree.es/es/analisis/600