# Statistics plotting for validation of MSAR models

### 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 |

### 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 |

`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(data,Y.sim$Y)
``` |