knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)

This document was created with package version r packageVersion("smires"). Currently the following datasets are already included in the package:

library(smires)
data(package = "smires")$results[, "Item"]

When calculating metrics regarding the duration of intermittency, a ternary time series (no-flow, flow, NA) can be derived. The binary series is added as a column named state.

b <- detect_noflow_events(balder)
head(b)

Metrics for grouped time series

events <- balder %>% 
  detect_noflow_events() %>% 
  per(period = "year") %>% 
  duration()

print(events)
events <- duration(per(detect_noflow_events(balder), period = "year"))
plot_events(events)
ggplot(events, aes(duration)) + geom_histogram(bins = 10) + 
  facet_wrap(~state) + 
  labs(x = "Duration of the state in days")

ggplot(events, aes(duration, col = state)) + stat_ecdf() + 
  labs(x = "Duration of the state in days", y = "Probability of non-Exceedance", 
       title = "Empirical Cumulative Distribution Function (ECDF)")
bb <- events %>% group_by(period, state) %>% 
  summarise(duration = max(duration)) %>% 
  group_by(state) %>% summarise(mDur = mean(duration))

bb
ggplot(events, aes(duration)) + geom_histogram(binwidth = 10) + 
  scale_x_continuous(limits = c(0, NA)) + 
  facet_grid(period~state) + 
  labs(x = "Duration of the state in days")


mundl/smires documentation built on May 23, 2019, 8:22 a.m.