Plot the mean duration of sojourn over thresholds for an observed time series and a simulated one with respect to the empirical cumulative distribution function. Fluctuation intervals are plotted too.

1 | ```
MeanDurOver(data, data.sim, u, alpha = 0.05,col="red")
``` |

`data` |
observed (or reference) time series, array of dimension T*N.samples*1 |

`data.sim` |
simulated time series, array of dimension T*N.sim*1. N.sim have to be K*N.samples with K large enough (for instance, K=100) |

`u` |
vector of thresholds |

`alpha` |
1-confidence level for fluctuation intervals. Default = 0.05 |

`col` |
color of the lines for simulated data |

Returns a plot and a list including ..$F : empirical cdf of data for levels u ..$mdo.data : mean duration over levels u for data ..$F.sim : empirical cdf of simulations for levels u ..$mdo.sim : mean duration over levels u for simulations ..$CI : confidence intervals of mean duration over levels u for simulations ..$mod.sim.all : mean duration over levels u for all simulations

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

valid_all

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
data(meteo.data)
data = array(meteo.data$temperature,c(31,41,1))
k = 40
T = dim(data)[1]
N.samples = dim(data)[2]
d = dim(data)[3]
M = 2
order = 2
theta.init = init.theta.MSAR(data,M=M,order=order,label="HH")
mod.hh= NULL
mod.hh$theta = theta.init
mod.hh$theta$A = matrix(c(0.40,0.88,-.09,-.13),2,2)
mod.hh$theta$A0 = matrix(c(6.75,1.08),2,1)
mod.hh$theta$sigma = matrix(c(1.76,3.40),2,1)
mod.hh$theta$prior = matrix(c(0.37,0.63),2,1)
mod.hh$theta$transmat = matrix(c(0.82,0.09,0.18,0.91),2,2)
B.sim = 20*N.samples
Y0 = array(data[1:2,sample(1:dim(data)[2],B.sim,replace=TRUE),],c(2,B.sim,1))
Y.sim = simule.nh.MSAR(mod.hh$theta,Y0=Y0,T,N.samples=B.sim)
u = seq(min(data),max(data),length.out=30)
MDO = MeanDurOver(data,Y.sim$Y,u)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.