View source: R/sdftest-functions.R
| sdf.test | R Documentation |
Performs the test for equality of spectral densities of two time series.
sdf.test(
X1,
X2,
Te,
alpha,
q1 = 4,
method1 = "GCV",
f1_true = NULL,
q2 = q1,
method2 = method1,
f2_true = f1_true,
N = 10000,
cores = 1,
nulldistr = NULL
)
X1 |
Longest time series. |
X2 |
Shortest time series. |
Te |
Integer. Number of bins. |
alpha |
Numeric. Significance level for the test. |
q1 |
Integer. Penalisation order for |
method1 |
Character. Method for selecting the smoothing parameter for
|
f1_true |
Vector or |
q2 |
Integer. Penalization order for |
method2 |
Character. Method for selecting the smoothing parameter for
|
f2_true |
Vector or |
N |
Integer. Number of iterations for null distribution computa-
tion (default |
cores |
Integer. Number of cores for parallel computation of null
distribution (default |
nulldistr |
Vector or |
An object of class "test", which is a list containing the
following components:
result |
Logical. |
S |
Value of the statistic. |
quantile |
Empirical quantile used for the test. |
pval |
p-value of the test according to the empirical null distribution. |
nulldistr |
Vector of empirical null distribution. |
Nadin, Krivobokova, Enikeeva (2026). Nonparametric two sample test of spectral densities. https://arxiv.org/abs/2602.10774
demo("eeg", package = "sdf.test") for the EEG application
from Nadin, Krivobokova, Enikeeva (2026).
# --- Example 1: Using random data ---
test <- sdf.test(
X1 = rnorm(100), X2 = rnorm(80),
q1 = 4, method1 = "GCV", Te = 20, alpha = 0.05, N = 1000
)
test
# --- Example 2: Using random data ---
X1 <- arima.sim(list(order=c(1,0,0),ar=0.5),n = 1200,rand.gen = rnorm, sd = 1)
X2 <- arima.sim(list(order=c(1,0,0),ar=0.8),n = 1000,rand.gen = rnorm, sd = 1)
sdf.test(
X1 = X1, X2 = X2,
q1 = 4, method1 = "GCV", Te = 176, alpha = 0.05
)
# --- Example 3: Using EEG dataset ---
# Takes a long time; run it with:
# demo("eeg", package = "sdf.test")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.