Srho {tseriesEntropy} | R Documentation |
Entropy Measure Of Serial And Cross Dependence
Description
Entropy based measure of serial and cross dependence for integer or categorical data. Implements a normalized version of the Hellinger/Matusita distance. As shown in the references the metric measure is a proper distance.
Usage
Srho(x, y, lag.max, stationary = TRUE, plot = TRUE, version = c("FORTRAN","R"),
nor = FALSE)
Arguments
x , y |
integer or factor time series objects or vectors. ( |
lag.max |
maximum lag at which to calculate Srho; default is |
stationary |
logical. If |
plot |
logical. If |
version |
either |
nor |
logical. If |
Details
- Univariate version: serial entropy
Srho(x, lag.max, stationary = TRUE, plot = TRUE, version = c("FORTRAN","R"), nor = FALSE)
- Bivariate version: cross entropy
Srho(x, y, lag.max, stationary = TRUE, plot = TRUE, version = c("FORTRAN","R"), nor = FALSE)
This implementation of the measure is normalized to take values in [0, 1]. Normalization is performed with respect to the maximum attainable value computed analytically. This makes the results of Srho comparable among different series.
Value
An object of S4 class "Srho", which is a list with the following elements:
.Data |
vector of |
lags |
integer vector that contains the lags at which Srho is computed. |
stationary |
Object of class |
data.type |
Object of class |
notes |
Object of class |
Warning
Unlike ccf
the lag k value returned by Srho(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.
Giannerini S., Maasoumi E., Bee Dagum E., (2015), Entropy testing for nonlinear serial dependence in time series, Biometrika, 102(3), 661–675 doi:10.1093/biomet/asv007.
Maasoumi E., (1993) A compendium to information theory in economics and econometrics. Econometric Reviews, 12(2), 137–181.
See Also
See Also Srho.test
. The function Srho.ts
implements the same measure for numeric data.
Examples
## UNIVARIATE VERSION
x <- as.integer(rbinom(n=20,size=4,prob=0.5))
Srho(x,lag.max=4)
## BIVARIATE VERSION
y <- as.integer(rbinom(n=20,size=4,prob=0.5))
Srho(x,y,lag.max=4)
## EXAMPLE 1: the effect of normalization
## computes the maximum attainable value by correlating x with itself
set.seed(12)
K <- 5 # number of categories
smax <- 1-1/sqrt(K) # theoretical maximum under the uniform distribution
x <- as.integer(sample(1:K,size=1e3,replace=TRUE)) # generates the sequence
S <- Srho(x,x,lag.max=2,nor=FALSE,plot=FALSE)
plot(S,lwd=2,col=4)
abline(h=smax,col=2,lty=2)
text(x=-1,y=0.54,labels=paste("theoretical maximum = ",round(smax,4),sep=""),col=2)
text(x=-1,y=0.45,labels=paste("estimated maximum = ",round(S[3],4),sep=""),col=4)