cor.MSAR: Empirical correlation functions comparison .

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/cor.MSAR.R

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

1
2
cor.MSAR(data,data.sim,lag=NULL,nc=1,alpha=.05,plot=FALSE,
   xlab="Time (days)",dt=1,ylab="Correlation",...)

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.

plot

if plot is TRUE plots are drawn (default is FALSE).

xlab

x axis label

dt

default time step is equal to 1

ylab

y axis label

...

for optional plot arguments

Details

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

Value

A list with the following elements:

C.data

observed data acf

C.sim

simulated data acf

CI.sim

fluctuation interval for each lag

lags

abscissa for acfs

Author(s)

Valerie Monbet, valerie.monbet@univ-rennes1.fr

References

Bessac, J., Ailliot, P., Monbet, V. (2015). Gaussian linear state-space model for wind fields in the North-East Atlantic. Environmetrics, 26(1), 29-38.

See Also

cross.cor.MSAR, cor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

Example output



NHMSAR documentation built on Feb. 9, 2022, 9:06 a.m.

Related to cor.MSAR in NHMSAR...