valid_all.MSAR: Statistics plotting for validation of MSAR models

Description Usage Arguments Value Author(s) Examples

View source: R/valid_all.MSAR.R

Description

plots some functional statistics to help to valid MSAR models: qqplot, covariance function, mean duration of sojourn over and under a threshold. For each of them the empirical statistic of the observed time series is plotted as well as the simulated one with (1-α)-fluctuation intervals.

Usage

1
2
3
valid_all.MSAR(data,simu,title="",id=1,alpha=.05,spaghetti=TRUE,
mfrow=NULL,save=FALSE,output=FALSE,
root.filename=" ",path=NULL,col="red",width=4,height=4)

Arguments

data

observed (or reference) time series, array of dimension T*N.samples*d

simu

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)

title

title of plots

id

component to be considered when the data is multivariate (d>1). Default d=1.

alpha

level for the (1-α)-fluctuation intervals

spaghetti

statistics of every simulation batch are plotted instead of fluctuation intervals. A batch is a simulation block of the same size as the observations. Default spaghetti=TRUE

mfrow

if NULL, each plot is done in a new window

save

if save=TRUE plots are saved into .eps files

root.filename

root file name for saving plots

path

path of folder where to save the files

output

if TRUE some statistics are returned.

col

color of the lines for simulated data, default is red

width

width of the figure when is it save by dev.copy2eps

height

height of the figure when is it save by dev.copy2eps

Value

Returns plots and

qqp

statistics of marginal distributions

C

statistics of correlation functions

ENu.data

statistics of intensity of up crossings of the data

ENu.simu

statistics of intensity of up crossings of the simulations

MDO

statistics of mean duration over a level

MDU

statistics of mean duration under a level

Author(s)

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(meteo.data)
data = array(meteo.data$temperature,c(31,41,1)) 
k = 40
plot(data[,k,1],typ="l",xlab=("time (days)"),ylab=("temperature (degrees C)"))
T = dim(data)[1]
N.samples = dim(data)[2]
d = dim(data)[3]
# Fit Homogeneous MS-AR models
M = 2
order = 1
theta.init = init.theta.MSAR(data,M=M,order=order,label="HH") 
mod.hh = fit.MSAR(data,theta.init,verbose=TRUE,MaxIter=10)
# Simulation
yT = 31
Bsim = 10
Ksim = Bsim*N.samples
Y0 = array(data[1:2,sample(1:dim(data)[2],Ksim,replace=T),],c(2,Ksim,1))
Y.sim = simule.nh.MSAR(mod.hh$theta,Y0 = Y0,T,N.samples = Ksim) 
valid_all.MSAR(data,Y.sim$Y)

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