Title: | Hypothesis Tests for Functional Time Series |
---|---|
Description: | Provides a collection of white noise hypothesis tests for functional time series and related visualizations. These include tests based on the norms of autocovariance operators that are built under both strong and weak white noise assumptions. Additionally, tests based on the spectral density operator and on principal component dimensional reduction are included, which are built under strong white noise assumptions. Also, this package provides goodness-of-fit tests for functional autoregressive of order 1 models. These methods are described in Kokoszka et al. (2017) <doi:10.1016/j.jmva.2017.08.004>, Characiejus and Rice (2019) <doi:10.1016/j.ecosta.2019.01.003>, Gabrys and Kokoszka (2007) <doi:10.1198/016214507000001111>, and Kim et al. (2023) <doi: 10.1214/23-SS143> respectively. |
Authors: | Mihyun Kim [aut, cre], Daniel Petoukhov [aut] |
Maintainer: | Mihyun Kim <[email protected]> |
License: | GPL-3 |
Version: | 1.1.0 |
Built: | 2024-11-26 06:49:43 UTC |
Source: | CRAN |
'autocorrelation_coeff_h' Computes the approximate functional autocorrelation coefficient at a given lag.
autocorrelation_coeff_h(f_data, lag)
autocorrelation_coeff_h(f_data, lag)
f_data |
the functional data matrix with observed functions in the columns |
lag |
the lag to use to compute the single lag test statistic |
numeric value; the approximate functional autocorrelation coefficient at lag h.
'autocorrelation_coeff_plot' Computes the 1-alpha upper confidence bounds for the functional autocorrelation coefficients at lags h = 1:K under both weak white noise (WWN) and strong white noise (SWN) assumptions. It plots the coefficients as well as the bounds for all lags h = 1:K. Note, the SWN bound is constant, while the WWN is dependent on the lag.
autocorrelation_coeff_plot( f_data, K = 20, alpha = 0.05, M = NULL, wwn_bound = TRUE )
autocorrelation_coeff_plot( f_data, K = 20, alpha = 0.05, M = NULL, wwn_bound = TRUE )
f_data |
The functional data matrix with observed functions in the columns. |
K |
A positive Integer value. The maximum lag for which to compute the single-lag test (tests will be computed for lags h in 1:K). |
alpha |
A numeric value between 0 and 1 specifying the significance level to be used in the single-lag test. The default value is 0.05. |
M |
A positive Integer value. Determines the number of Monte-Carlo simulations employed in the Welch-Satterthwaite approximation of the limiting distribution of the test statistics, for each test. |
wwn_bound |
A Boolean value allowing the user to turn off the weak white noise bound. TRUE by default. Speeds up computation when FALSE. |
This function computes and plots autocorrelation coefficients at lag h, for h in 1:K. It also computes an estimated asymptotic 1 - alpha confidence bound, under the assumption that the series forms a weak white noise. Additionally, it computes a similar (constant) bound under the assumption the series form a strong white noise. Please see the vignette or the references for a more complete treatment.
Plot of the estimated autocorrelation coefficients for lags h in 1:K with the weak white noise 1-alpha upper confidence bound for each lag, as well as the constant strong white noise 1-alpha 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.
b <- brown_motion(75, 40) autocorrelation_coeff_plot(b) autocorrelation_coeff_plot(b, M = 200)
b <- brown_motion(75, 40) autocorrelation_coeff_plot(b) autocorrelation_coeff_plot(b, M = 200)
'autocov_approx_h' computes the approximate autocovariance for a given lag h of the functional data
autocov_approx_h(f_data, lag)
autocov_approx_h(f_data, lag)
f_data |
the functional data matrix with observed functions in the columns |
lag |
the lag to use to compute the single lag test statistic |
A 2-dimensional array encoding the autocovariance matrix for a given lag h.
'B_h_bound' Computes an approximate asymptotic upper 1-alpha confidence bound for the functional autocorrelation coefficient at lag h under a weak white noise assumption.
B_h_bound(f_data, lag, alpha = 0.05, M = NULL)
B_h_bound(f_data, lag, alpha = 0.05, M = NULL)
f_data |
the functional data matrix with observed functions in the columns |
lag |
the lag to use to compute the single lag test statistic |
alpha |
the significance level to be used in the hypothesis test |
M |
Number of samples to take when applying a Monte-Carlo approximation |
numeric value; the 1-alpha confidence bound for the functional autocorrelation coefficient at lag h under a weak white noise assumption.
'B_iid_bound' Computes an approximate asymptotic upper 1-alpha confidence bound for the functional autocorrelation coefficient at lag h under the assumption that f_data forms a strong white noise
B_iid_bound(f_data, alpha = 0.05)
B_iid_bound(f_data, alpha = 0.05)
f_data |
the functional data matrix with observed functions in the columns |
alpha |
the significance level to be used in the hypothesis test |
Numeric value; the 1-alpha confidence bound for the functional autocorrelation coefficient at lag h under a strong white noise assumption.
'bartlett_kernel' Computes the Bartlett kernel function at a given point value.
bartlett_kernel(x)
bartlett_kernel(x)
x |
the point value at which the kernel function is evaluated |
A scalar value; the value of the Bartlett kernel function at the point value x.
'block_bootstrap' Performs a block bootstrap on the functional data f_data with block size b.
block_bootsrap(f_data, b, B = 300, moving = FALSE)
block_bootsrap(f_data, b, B = 300, moving = FALSE)
f_data |
the functional data matrix with observed functions in the columns |
b |
the block size (of each block in each bootstrap sample) |
B |
the number of bootstraps samples |
moving |
boolean value specifying whether the block bootstrap should be moving or not. A moving black bootstrap samples individual functional observations and adds on the consequent block, rather than sampling blocks of the data. |
Returns a list of B elements, each element being a block bootstrap sample in the same format as the original functional data f_data.
'brown_motion' Creates at J x N matrix, containing N independent Brownian motion sample paths in each of the columns.
brown_motion(N, J)
brown_motion(N, J)
N |
the number of independent Brownian motion sample paths to compute. |
J |
the number of steps observed for each sample path (the resolution of the data). |
A J x N matrix containing Brownian motion functional data in the columns.
b <- brown_motion(250, 50)
b <- brown_motion(250, 50)
'center' Centers the given functional data
center(f_data)
center(f_data)
f_data |
the functional data matrix with observed functions in the columns |
A matrix of the same form as f_data containing the centered functional data.
'covariance_diag_store' Creates a list storage of approximate diagonal covariances computed by the function diagonal_covariance_i
covariance_diag_store(f_data, K)
covariance_diag_store(f_data, K)
f_data |
the functional data matrix with observed functions in the columns |
K |
the range of lags 1:K to use |
A list containing K 2-dimensional arrays containing the diagonal covariance matrices of the functional data, for lags h in the range 1:K.
'covariance_i_j' computes the approximate covariance tensor of the functional data for lag windows defined by i,j.
covariance_i_j(f_data, i, j)
covariance_i_j(f_data, i, j)
f_data |
the functional data matrix with observed functions in the columns |
i , j
|
the indices i,j in 1:T that we are computing the covariance for |
A 4-dimensional array, encoding the covariance tensor of the functional data for lag windows defined by i,j.
'covariance_i_j_vec' computes the approximate covariance tensor of the functional data for lag windows defined by i,j; a vectorized version of covariance_i_j.
covariance_i_j_vec(f_data, i, j)
covariance_i_j_vec(f_data, i, j)
f_data |
the functional data matrix with observed functions in the columns |
i , j
|
the indices i,j in 1:T that we are computing the covariance for |
A 4-dimensional array, encoding the covariance tensor of the functional data for lag windows defined by i,j.
'daniell_kernel' Computes the Daniell kernel function at a given point value.
daniell_kernel(x)
daniell_kernel(x)
x |
the point value at which the kernel function is evaluated |
A scalar value; the value of the Daniell kernel function at the point value x.
'diagonal_autocov_approx_0' Computes the diagonal covariance of the given functional data.
diagonal_autocov_approx_0(f_data)
diagonal_autocov_approx_0(f_data)
f_data |
the functional data matrix with observed functions in the columns |
A numeric value; integral approximation of the diagonal covariance of the functional data.
'diagonal_covariance_i' computes the approximate diagonal covariance matrix of the functional data for lag windows defined by i.
diagonal_covariance_i(f_data, i)
diagonal_covariance_i(f_data, i)
f_data |
the functional data matrix with observed functions in the columns |
i |
the index in 1:T that we are computing the covariance for |
A 2-dimensional array, encoding the covariance matrix of the functional data for lag windows defined by i.
'far_1_S' Simulates an FAR(1,S)-fGARCH(1,1) process with N independent observations, each observed discretely at J points on the interval [0,1].
far_1_S(N, J, S, type = "IID", burn_in = 50)
far_1_S(N, J, S, type = "IID", burn_in = 50)
N |
the number of fGARCH(1,1) curves to sample. |
J |
the number of points at which each curve is sampled (the resolution of the data). |
S |
the autoregressive operator of the model, between 0 and 1, indicating the level of conditional heteroscedasticity. |
type |
the assumed model of the error term. The default argument is 'IID', under which the errors are assumed to be independent and identically distributed. The alternative argument is 'fGARCH', which will assume that the errors follow an fGARCH(1,1) process. |
burn_in |
the number of initial samples to burn (discard). |
A J x N matrix containing FAR(1,S) functional data in the columns.
f <- far_1_S(100, 50, 0.75)
f <- far_1_S(100, 50, 0.75)
'fgarch_1_1' Simulates an fGARCH(1,1) process with N independent observations, each observed
fgarch_1_1(N, J, delta = 0.01, burn_in = 50)
fgarch_1_1(N, J, delta = 0.01, burn_in = 50)
N |
the number of fGARCH(1,1) curves to sample. |
J |
the number of points at which each curve is sampled (the resolution of the data). |
delta |
a parameter used in the variance recursion of the model. |
burn_in |
the number of initial samples to burn (discard). |
A list containing two J x N matrices, the former containing the sample of fGARCH(1,1) curves and the latter containing the respective variance values.
f <- fgarch_1_1(100, 50)
f <- fgarch_1_1(100, 50)
'fport_test' computes a variety of white noise tests for functional data. All white noise tests in this package are accessible through this function.
fport_test( f_data, test = "multi-lag", lag = NULL, iid = FALSE, M = NULL, kernel = "Bartlett", bandwidth = "adaptive", components = 3, bootstrap = FALSE, block_size = "adaptive", moving = FALSE, straps = 300, alpha = 0.05, complete_test = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
fport_test( f_data, test = "multi-lag", lag = NULL, iid = FALSE, M = NULL, kernel = "Bartlett", bandwidth = "adaptive", components = 3, bootstrap = FALSE, block_size = "adaptive", moving = FALSE, straps = 300, alpha = 0.05, complete_test = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns. |
test |
A String specifying the hypothesis test. Currently available tests are referred to by their string handles: "single-lag", "multi-lag", "spectral", "independence", and "imhof". Please see the Details section of the documentation, or the vignette, for a short overview of the available tests. For a more complete treatment of these hypothesis tests, please consult the references. |
lag |
A positive integer value. Only used for the "single-lag", "multi-lag", "independence", and "imhof" tests. This parameter specifies the single lag, or maximum lag, to be used by the specified test. |
iid |
Only used for the "single-lag" and "multi-lag" tests. A Boolean value, FALSE by default. If given TRUE, the hypothesis test will use a strong-white noise assumption (instead of a weak-white noise assumption). |
M |
Only used for the "single-lag" and "multi-lag" tests. A positive Integer. Determines the number of Monte-Carlo simulations employed in the Welch-Satterthwaite approximation of the limiting distribution of the test statistic. |
kernel |
Only used for the "spectral" test. A String, 'Bartlett' by default. Specifies the kernel to be used in the "spectral" test. Currently supported kernels are the 'Bartlett' and 'Parzen' kernels. |
bandwidth |
Only used for the "spectral" test. Either a String or a positive Integer value, 'adaptive' by default. Determines the bandwidth (or lag-window) to be used for the test. Given the string handle 'adaptive', the bandwidth is computed via a bandwidth selection method which aims to minimize the integrated normed error of the spectral density operator. If the given string handle is 'static', the bandwidth is computed to be n^(1/(2q + 1)), where n is the sample size and q is the kernel order. If a positive integer is given, that will be the bandwidth that is used. |
components |
Only used for the "independence" test. A positive Integer value. Determines the number of functional principal components to use (ranked by their importance). |
bootstrap |
Only used for the "single-lag" test. A Boolean value, FALSE by default. If given TRUE, the hypothesis test is evaluated by approximating the limiting distribution of the test statistic via a block bootstrapping process. |
block_size |
Only used for the "single-lag" test in the case when 'bootstrap' = TRUE. A positive Integer value, with the default value being computed via the adaptive bandwidth selection method in the "spectral" test. Determines the block size (of each block in each bootstrap sample) if the test is being bootstrapped. |
moving |
Only used for the "single-lag" test in the case when 'bootstrap' = TRUE. A Boolean value, FALSE by default If given TRUE, the performed block bootstrap will be moving rather than stationary. |
straps |
Only used for the "single-lag" test in the case when 'bootstrap' = TRUE. A positive Integer with a default value of 300. Determines the number of bootstrap samples to take if the test is being bootstrapped. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
complete_test |
A Boolean value, FALSE by default. If TRUE, the function requires no other parameters other than f_data, and will return a table with a single column containing p-values from an array of tests contained in the rows. |
suppress_raw_output |
A Boolean value, FALSE by default. If given TRUE, the function will not return a list containing the p-value, quantile and statistic, and instead only prints output to the console. |
suppress_print_output |
A Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
The "single-lag" portmanteau test is based on the sample autocovariance function computed from the functional data. This test assesses the significance of lagged autocovariance operators at a single, user-specified lag h. More specifically, it tests the null hypothesis that the lag-h autocovariance operator is equal to 0. This test is designed for stationary functional time-series, and is valid under conditional heteroscedasticity conditions. The required parameter for this test is 'lag', which determines the lag at which the test is evaluated. If this parameter is left blank, it will take a default of 1. The optional parameters for this test are 'iid', 'M', 'bootstrap', 'block_size', 'straps', 'moving',and 'alpha'.
The "multi-lag" portmanteau test is also based on the sample autocovariance function computed from the functional data. This test assesses the cumulative significance of lagged autocovariance operators, up to a user-selected maximum lag K. More specifically, it tests the null hypothesis that the first K lag-h autocovariance operators (h going from 1 to K) is equal to 0. This test is designed for stationary functional time-series, and is valid under conditional heteroscedasticity conditions. The required parameter for this test is 'lag', which determines the maximum lag at which the test is evaluated. If this parameter is left blank, it will take a default of 20. The optional parameters for this test are 'iid', 'M', 'bootstrap', 'block_size', 'straps', 'moving', and 'alpha'.
The "spectral" portmanteau test is based on the spectral density operator. It essentially measures the proximity of a functional time series to a white noise - the constant spectral density operator of an uncorrelated series. Unlike the "single-lag" and "multi-lag" tests, this test is not for general white noise series, and may not hold under functional conditionally heteroscedastic assumptions. The optional parameters for this test are 'kernel', 'bandwidth', and 'alpha'.
The "independence" portmanteau test is a test of independence and identical distribution based on a dimensionality reduction by projecting the data onto the most important functional principal components. It is based on the resulting lagged cross-variances. This test is not for general white noise series, and may not hold under functional conditionally heteroscedastic assumptions. The required parameters for this test are 'lag' and 'components'. The 'lag' parameter determines the maximum lag at which the test is evaluated. The 'components' parameter determines the number of the most important principal components to use (importance is determined by the proportion of the variance that is explained by the individual principal component.)
The "imhof" portmanteau test is an analogue of the "single-lag" test. While the "single-lag" test computes the limiting distribution of the test statistic via a Welch-Satterthwaite approximation, the "imhof" test directly computes the coefficients of the quadratic form in Normal variables which the test statistic converges too as the sample size goes to infinity. We warn the user that this test is extremely computationally expensive, and is only recommended for small datasets as a means of cross-verification against the single-lag test. The required parameter for this test is 'lag', which determines the lag at which the test is evaluated. The "imhof" test requires the "tensorA" and "CompQuadForm" packages. Note also that the imhof test does not return a statistic, and thus returns a list with only 2 elements if suppress_raw_output = FALSE.
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. If 'complete-test' = TRUE, will return a 1-column table instead containing the p-values for a variety of tests, which are given short descriptions in the index of the table.
[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] Characiejus V., & Rice G. (2019). A general white noise test based on kernel lag-window estimates of the spectral density operator. Econometrics and Statistics, submitted.
[3] Gabrys R., & Kokoszka P. (2007). Portmanteau Test of Independence for Functional Observations. Journal of the American Statistical Association, 102:480, 1338-1348, DOI: 10.1198/016214507000001111.
[4] Zhang X. (2016). White noise testing and model diagnostic checking for functional time series. Journal of Econometrics, 194, 76-95.
[5] Chen W.W. & Deo R.S. (2004). Power transformations to induce normality and their applications. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 66, 117–130.
b <- brown_motion(250, 50) fport_test(b, test = 'single-lag', lag = 10) fport_test(b, test = 'multi-lag', lag = 10, alpha = 0.01) fport_test(b, test = 'single-lag', lag = 1, M = 250) fport_test(b, test = 'spectral', kernel = 'Bartlett', bandwidth = 'static', alpha = 0.05) fport_test(b, test = 'spectral', alpha = 0.1, kernel = 'Parzen', bandwidth = 'adaptive') fport_test(b, test = 'independence', components = 3, lag = 3)
b <- brown_motion(250, 50) fport_test(b, test = 'single-lag', lag = 10) fport_test(b, test = 'multi-lag', lag = 10, alpha = 0.01) fport_test(b, test = 'single-lag', lag = 1, M = 250) fport_test(b, test = 'spectral', kernel = 'Bartlett', bandwidth = 'static', alpha = 0.05) fport_test(b, test = 'spectral', alpha = 0.1, kernel = 'Parzen', bandwidth = 'adaptive') fport_test(b, test = 'independence', components = 3, lag = 3)
The "GOF_far" test 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 K. More specifically, it tests the null hypothesis that the first K lag-h autocovariance operators (h going from 1 to K) from the model residuals is equal to 0.
GOF_far( f_data, lag = 5, M = 10000, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
GOF_far( f_data, lag = 5, M = 10000, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns. |
lag |
Positive integer value. A user-selected maximum lag. 10 by default. |
M |
Positive integer value. Number of Monte-Carlo simulation for Welch-Satterthwaite approximation.10000 by default. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
suppress_raw_output |
Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
'GOF_far' computes the goodness-of-fit test for FAR(1) over a range of user-specified lags.
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.
[1] Kim, M., Kokoszka, P., & Rice, G. (2023). White noise testing for functional time series. Statistic Surveys, 17, 119-168.
f <- far_1_S(100, 50, 0.75) GOF_far(f, lag=5)
f <- far_1_S(100, 50, 0.75) GOF_far(f, lag=5)
'iid_covariance' A helper function used to compute one of the two independent sum terms in the computation of the approximate covariance of the functional data under a strong white noise assumption.
iid_covariance(f_data)
iid_covariance(f_data)
f_data |
the functional data matrix with observed functions in the columns |
A 2-dimensional matrix containing one of the two independent sums in the computation of the covariance.
'iid_covariance_vec' A helper function used to compute one of the two independent sum terms in the computation of the approximate covariance of the functional data under a strong white noise assumption; a vectorized version of iid_covariance.
iid_covariance_vec(f_data)
iid_covariance_vec(f_data)
f_data |
the functional data matrix with observed functions in the columns |
A 2-dimensional matrix containing one of the two independent sums in the computation of the covariance.
'independence_test' Computes the independence test with a user-specified number of principal components and range of lags.
independence_test( f_data, components, lag, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
independence_test( f_data, components, lag, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns |
components |
A positive Integer specifying the number of principal components to project the data on; ranked in order of importance (importance is determined by the proportion of the variance that is explained by the individual principal component.) |
lag |
A positive Integer value, specifying the maximum lag to include - this can be seen as the bandwidth or lag-window. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
suppress_raw_output |
Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
The "independence" portmanteau test is a test of independence and identical distribution based on a dimensionality reduction by projecting the data onto the most important functional principal components. It is based on the resulting lagged cross-variances. This test is not for general white noise series, and may not hold under functional conditionally heteroscedastic assumptions. Please consult the vignette for a deeper exposition, and consult the reference for a complete treatment.
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.
[1] Gabrys R., & Kokoszka P. (2007). Portmanteau Test of Independence for Functional Observations. Journal of the American Statistical Association, 102:480, 1338-1348, DOI: 10.1198/016214507000001111.
b <- brown_motion(250, 100) independence_test(b, components = 3, lag = 5)
b <- brown_motion(250, 100) independence_test(b, components = 3, lag = 5)
'multi_lag_test' Computes the multi-lag hypothesis test over a range of user-specified lags.
multi_lag_test( f_data, lag = 20, M = NULL, iid = FALSE, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
multi_lag_test( f_data, lag = 20, M = NULL, iid = FALSE, alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns |
lag |
Positive integer value. The lag to use to compute the multi-lag test statistic |
M |
Positive integer value. Number of Monte-Carlo simulation for Welch-Satterthwaite approximation. |
iid |
A Boolean value, FALSE by default. If given TRUE, the hypothesis test will use a strong-white noise assumption (instead of a weak-white noise assumption). |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
suppress_raw_output |
Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
The "multi-lag" portmanteau test is also based on the sample autocovariance function computed from the functional data. This test assesses the cumulative significance of lagged autocovariance operators, up to a user-selected maximum lag K. More specifically, it tests the null hypothesis that the first K lag-h autocovariance operators (h going from 1 to K) is equal to 0. This test is designed for stationary functional time-series, and is valid under conditional heteroscedasticity conditions.
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.
[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.
b <- brown_motion(150, 50) multi_lag_test(b, lag = 5) multi_lag_test(b, lag = 10, M = 50)
b <- brown_motion(150, 50) multi_lag_test(b, lag = 5) multi_lag_test(b, lag = 10, M = 50)
'parzen_kernel' Computes the Parzen kernel function at a given point value.
parzen_kernel(x)
parzen_kernel(x)
x |
the point value at which the kernel function is evaluated |
A scalar value; the value of the Parzen kernel function at the point value x.
'Q_WS_hyp_test' computes the size alpha test of a single lag hypothesis under a weak white noise or strong white noise assumption using a Welch-Satterthwaite Approximation.
Q_WS_hyp_test( f_data, lag, alpha = 0.05, iid = FALSE, M = NULL, bootstrap = FALSE, block_size = "adaptive", straps = 300, moving = FALSE )
Q_WS_hyp_test( f_data, lag, alpha = 0.05, iid = FALSE, M = NULL, bootstrap = FALSE, block_size = "adaptive", straps = 300, moving = FALSE )
f_data |
The functional data matrix with observed functions in the columns |
lag |
Positive integer value. The lag to use to compute the single lag test statistic. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
iid |
A Boolean value, FALSE by default. If given TRUE, the hypothesis test will use a strong-white noise assumption (instead of a weak-white noise assumption). |
M |
Positive integer value. Number of Monte-Carlo simulations for the Welch-Satterthwaite approximation. |
bootstrap |
A Boolean value, FALSE by default. If given TRUE, the hypothesis test is done by approximating the limiting distribution of the test statistic via a block bootstrap process. |
block_size |
A positive Integer value, with the default value being computed via the adaptive bandwidth selection method in the "spectral" test. Determines the block size (of each block in each bootstrap sample) if the test is being bootstrapped. |
straps |
A positive Integer, with a default value of 300. Determines the number of bootstrap samples to take if the test is being bootstrapped. Only used if 'bootstrap' == TRUE. |
moving |
A Boolean value, FALSE by default. If given TRUE, the performed block bootstrap will be moving rather than stationary. |
A list containing the p-value, the quantile, and a boolean value indicating whether or not the hypothesis is rejected.
'scalar_covariance_i_j' computes the approximate covariance at a point of the functional data for lag windows defined by i,j; a scalarized version of covariance_i_j that takes point estimates.
scalar_covariance_i_j(f_data, i, j, times)
scalar_covariance_i_j(f_data, i, j, times)
f_data |
the functional data matrix with observed functions in the columns |
i , j
|
the indices i,j in 1:T that we are computing the covariance for |
times |
A vector with 4 columns containing indices specifying which subset of f_data to consider |
A numeric value; the covariance of the functional data at a point for lag windows defined by i,j.
'scalar_covariance_i_j_vec' computes the approximate covariance at a point of the functional data for lag windows defined by i,j; a vectorized version of scalar_covariance_i_j.
scalar_covariance_i_j_vec(f_data, i, j, times)
scalar_covariance_i_j_vec(f_data, i, j, times)
f_data |
the functional data matrix with observed functions in the columns |
i , j
|
the indices i,j in 1:T that we are computing the covariance for |
times |
A vector with 4 columns containing indices specifying which subset of f_data to consider |
A numeric value; the covariance of the functional data at a point for lag windows defined by i,j.
'single_lag_test' computes the single-lag hypothesis test at a single user-specified lag.
single_lag_test( f_data, lag = 1, alpha = 0.05, iid = FALSE, M = NULL, bootstrap = FALSE, block_size = "adaptive", straps = 300, moving = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
single_lag_test( f_data, lag = 1, alpha = 0.05, iid = FALSE, M = NULL, bootstrap = FALSE, block_size = "adaptive", straps = 300, moving = FALSE, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns |
lag |
Positive integer value. The lag to use to compute the single lag test statistic. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used in the specified hypothesis test. The default value is 0.05. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
iid |
A Boolean value, FALSE by default. If given TRUE, the hypothesis test will use a strong-white noise assumption (instead of a weak-white noise assumption). |
M |
Positive integer value. Number of Monte-Carlo simulations for the Welch-Satterthwaite approximation. |
bootstrap |
A Boolean value, FALSE by default. If given TRUE, the hypothesis test is done by approximating the limiting distribution of the test statistic via a block bootstrap process. |
block_size |
A positive Integer value, with the default value being computed via the adaptive bandwidth selection method in the "spectral" test. Determines the block size (of each block in each bootstrap sample) if the test is being bootstrapped. |
straps |
A positive Integer, with a default value of 300. Determines the number of bootstrap samples to take if the test is being bootstrapped. Only used if 'bootstrap' == TRUE. |
moving |
A Boolean value, FALSE by default. If given TRUE, the performed block bootstrap will be moving rather than stationary. |
suppress_raw_output |
Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
The "single-lag" portmanteau test is based on the sample autocovariance function computed from the functional data. This test assesses the significance of lagged autocovariance operators at a single, user-specified lag h. More specifically, it tests the null hypothesis that the lag-h autocovariance operator is equal to 0. This test is designed for stationary functional time-series, and is valid under conditional heteroscedasticity conditions.
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.
[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.
f <- far_1_S(150, 50, S = 0.75) single_lag_test(f, lag = 1) single_lag_test(f, lag = 2, M=100)
f <- far_1_S(150, 50, S = 0.75) single_lag_test(f, lag = 1) single_lag_test(f, lag = 2, M=100)
The "spectral" portmanteau test is based on the spectral density operator. It essentially measures the proximity of a functional time series to a white noise - the constant spectral density operator of an uncorrelated series. Unlike the "single-lag" and "multi-lag" tests, this test is not for general white noise series, and may not hold under functional conditionally heteroscedastic assumptions.
spectral_test( f_data, kernel = "Bartlett", bandwidth = "adaptive", alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
spectral_test( f_data, kernel = "Bartlett", bandwidth = "adaptive", alpha = 0.05, suppress_raw_output = FALSE, suppress_print_output = FALSE )
f_data |
The functional data matrix with observed functions in the columns |
kernel |
A String specifying the kernel function to use. The currently supported kernels are the 'Bartlett' and 'Parzen' kernels. The default kernel is 'Bartlett'. |
bandwidth |
A String or positive Integer value which specifies the bandwidth to use. Currently admitted string handles are 'static' which computes the bandwidth p via p = n^(1/(2q+1)) where n is the sample size and q is the kernel order, or 'adaptive' which uses a bandwidth selection method that is based on the functional data. |
alpha |
Numeric value between 0 and 1 specifying the significance level to be used for the test. The significance level is 0.05 by default. Note, the significance value is only ever used to compute the 1-alpha quantile of the limiting distribution of the specified test's test statistic. |
suppress_raw_output |
Boolean value, FALSE by default. If TRUE, the function will not return the list containing the p-value, quantile, and statistic. |
suppress_print_output |
Boolean value, FALSE by default. If TRUE, the function will not print any output to the console. |
'spectral_test' Computes the spectral hypothesis test under a user-specified kernel function and bandwidth; automatic bandwidth selection methods are provided.
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.
[1] Characiejus V., & Rice G. (2019). A general white noise test based on kernel lag-window estimates of the spectral density operator. Econometrics and Statistics, submitted.
[2] Chen W.W. & Deo R.S. (2004). Power transformations to induce normality and their applications. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 66, 117–130.
b <- brown_motion(100, 50) spectral_test(b) spectral_test(b, kernel = 'Parzen', bandwidth = 'adaptive') spectral_test(b, kernel = 'Bartlett', bandwidth = 2)
b <- brown_motion(100, 50) spectral_test(b) spectral_test(b, kernel = 'Parzen', bandwidth = 'adaptive') spectral_test(b, kernel = 'Bartlett', bandwidth = 2)