Learn R Programming

NHMSAR (version 1.0)

cor.MSAR: Empirical correlation functions comparison .

Description

Empirical correlation function of observed data and simulated data are plotted on the same figure. A fluctuation interval of simulations is added to help the comparison.

Usage

cor.MSAR(data, data.sim, lag = NULL, nc = 1, alpha = 0.05)

Arguments

data
observed (or reference) time series, array of dimension T*N.samples*d
data.sim
simulated time series, array of dimension T*N.sim*d. N.sim have to be K*N.samples with K large enough (for instance, K=100)
lag
maximum lag at which to calculate the empirical auto-correlation function. Default floor(T/2) with T the length of each data sample.
nc
number of component for which to calculate the empirical auto-correlation function.
alpha
confidence level for computation of the fluctuation interval. Default= 0.05.

Value

  • A list with the following elements:
  • C.dataobserved data acf
  • C.simsimulated data acf
  • CI.simfluctuation interval for each lag
  • lagsabscissa for acfs

Details

The auto-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

cross.cor.MSAR, cor

Examples

Run this code
## Not run
#data(Wind)
#T = dim(U)[1]
#N.samples = dim(U)[2]
#Y = array(U[,,1],c(T,N.samples,1))

#theta.init=init.theta.MSAR(Y,M=2,order=1,label="HH")
#res.hh = fit.MSAR(Y,theta.init,verbose=TRUE,MaxIter=10)
#Bsim = 2
#Ksim = Bsim*N.samples
#Y0 = array(Y[1,sample(1:dim(Y)[2],1,replace=T),],c(2,Ksim,1))
#Y.sim = simule.nh.MSAR(res.hh$theta,Y0 = Y0,T,N.samples = Ksim) 
#c = cor.MSAR(Y,Y.sim$Y)
#plot(c$lags/4,c$C.data,typ="l",xlab="Time (days)",ylab="ACF",xlim=c(0,8))
#abline(h=0,lty=3,col="gray")
#lines(c$lags/4,c$C.sim,col="red")
#lines(c$lags/4,c$CI.sim[1,],col="red",lty=2)
#lines(c$lags/4,c$CI.sim[2,],col="red",lty=2)

Run the code above in your browser using DataLab