R: Entropy Test For Serial And Cross Dependence For Categorical...
Srho.test
R Documentation
Entropy Test For Serial And Cross Dependence For Categorical Sequences
Description
Bootstrap/permutation tests of serial and cross dependence for integer or categorical sequences.
Usage
Srho.test(x, y, lag.max, B = 1000, stationary = TRUE, plot = TRUE, quant = c(0.95, 0.99),
nor = FALSE)
Arguments
x, y
integer or factor time series objects or vectors. (y is missing in the univariate case).
lag.max
maximum lag at which to calculate Srho; default is trunc(N/4) where N is the number of observations.
B
number of bootstrap/permutation replications.
stationary
logical. If TRUE assumes stationarity and computes marginal probabilities by using all the N observations. If FALSE uses N-k observations where k is the lag.
plot
logical. If TRUE(the default) produces a plot of Srho together with permutation confidence bands under the null hypothesis of independence.
quant
quantiles to be specified for the computation of the significant lags and the plot of confidence bands. Up to 2 quantiles can be specified.
Defaults are 95% and 99%.
nor
logical. If TRUE normalizes Srho with respect to its attainable maximum. Defaults to FALSE.
Details
Univariate version: test for serial dependence
Srho.test(x, lag.max, B = 1000,
stationary = TRUE, plot = TRUE, quant = c(0.95, 0.99), nor = FALSE)
Bivariate version: test for cross dependence
Srho.test(x, y, lag.max, B = 1000,
stationary = TRUE, plot = TRUE, quant = c(0.95, 0.99), nor = FALSE)
Value
An object of class "Srho.test", which is a list with the following elements:
.Data
vector of lag.max elements containing Srho computed at each lag.
quantiles
Object of class "matrix": contains the quantiles of the bootstrap/permutation distribution under the null hypothesis.
test.type
Object of class "character": contains a description of the type of test performed.
significant.lags
Object of class "list": contains the lags at which Srho exceeds the confidence bands at quant% under the null hypothesis.
p.value
Object of class "numeric": contains the bootstrap p-value for each lag.
lags
integer vector that contains the lags at which Srho is computed.
stationary
Object of class "logical": TRUE if the stationary version is computed.
data.type
Object of class "character": contains the data type.
notes
Object of class "character": additional notes.
Warning
Unlike ccf the lag k value returned
by Srho.test(x,y) estimates Srho between x[t] and
y[t+k]. The result is returned invisibly if plot is
TRUE.
Author(s)
Simone Giannerini<simone.giannerini@unibo.it>
References
Granger C. W. J., Maasoumi E., Racine J., (2004) A dependence metric for possibly nonlinear processes.
Journal of Time Series Analysis, 25(5), 649–669.
Maasoumi E., (1993) A compendium to information theory in economics and econometrics.
Econometric Reviews, 12(2), 137–181.
See Also
See also Srho, Srho.ts. The function Srho.test.ts implements the same test for numeric data.
Examples
set.seed(12)
x <- as.integer(rbinom(n=30,size=4,prob=0.5))
y <- as.integer(rbinom(n=30,size=4,prob=0.5))
z <- as.integer(c(4,abs(x[-30]*2-2))-rbinom(n=30,size=1,prob=1/2))
# no dependence
Srho.test(x,lag.max=4) # univariate
Srho.test(x,y,lag.max=4) # bivariate
# lag 1 dependence
Srho.test(x,z,lag.max=4) # bivariate