Srho | R Documentation |
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.
Srho(x, y, lag.max, stationary = TRUE, plot = TRUE, version = c("FORTRAN","R"),
nor = FALSE)
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 |
Srho(x, lag.max, stationary = TRUE, plot = TRUE, version = c("FORTRAN","R"), nor = FALSE)
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.
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 |
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.
Simone Giannerini<simone.giannerini@unibo.it>
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 \Sexpr[results=rd]{tools:::Rd_expr_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 Srho.test
. The function Srho.ts
implements the same measure for numeric data.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.