Learn R Programming

NHMSAR (version 1.4)

cross.cor.MSAR:

Description

cross.cor.MSAR computes the cross-correlation between two components. The cross-corelation can be estimted for the whole time series or regime by regime.

Usage

cross.cor.MSAR(data, X=NULL, nc1 = 1, nc2 = 2, lag = 10, regime = 0, 
CI = FALSE, Bsim = 0, N.samples = 1, add = FALSE, 
col = 1, names = NULL, alpha = 0.1,ylab="Cross-Correlation")

Arguments

data
observed (or reference) time series, array of dimension T*N.samples*d
X
time series of regimes associated to data
nc1
first component to be considered
nc2
second component to be considered
lag
maximum lag (default=10). The cross-correlation is estimated for lags -lag:lag.
regime
has to be an integer between 0 and M, with M the number of regimes. If regime=0, the cross correlaiton is computed for the whole time series. If regime=m>0, the corss corelation is computed considereing only the sub-sequences in regime m.
CI
If CI=TRUE fluctuation intervals are computed, default is FALSE
Bsim
useful for computation of confidence intervals. When observed and simulated data are compared, one expects that the number of simulated time series is Bsim*N.samples
N.samples
useful for computation of confidence intervals. N.sample describes the number of independant time series in the observed (or reference) data
add
if add=TRUE the empirical cross-correlation is added to the current plot.
col
color of the line
names
list with the names of components of data
alpha
level for the computation of the fluctuation intervals. default=0.1
ylab
legend for y axis

Value

returns a list including:
..$ccf
empirical cross-correlation
..$lag
abscissa for the cross-correlation
..$CI
fluctuation intervals

Details

The cross-correlation functions are computed from one or several independent realizations of the same length.

References

Bessac, J., Ailliot, P., & Monbet, V. (2013). Gaussian linear state-space model for wind fields in the North-East Atlantic. arXiv preprint arXiv:1312.5530.

See Also

cor.MSAR, cor, valid_all

Examples

Run this code
data(Wind)
T = dim(U)[1]
c = cross.cor.MSAR(U,nc1=1,nc2=18,names=1:18)
## Not run
#Y = U[,,c(1,18)]
#theta.init=init.theta.MSAR(Y,M=2,order=2,label="HH")
#res.hh = fit.MSAR(Y,theta.init,verbose=TRUE,MaxIter=200)
#Bsim = 20
#N.samples = dim(U)[2]
#Ksim = Bsim*N.samples
#Y0 = Y0
#Y.sim = simule.nh.MSAR(res.hh$theta,Y0 = Y0,T,N.samples = Ksim) 
#c.sim = cross.cor.MSAR(Y.sim$Y,nc1=1,nc2=2,names=c(1,18),
#   CI=TRUE,Bsim=Bsim,N.samples=N.samples,add=TRUE,col="red")

Run the code above in your browser using DataLab