rm(list = ls())
library(s2dv)
library(multiApply)
source("./R/Persistence.R")
source("./R/Regression.R")
x <- 1 : 100
dim(x) <- c(time = 100)
Regression(x, x)

.Persistence(x) #Expected fail
.Persistence(x, start = 1999) # Expected fail
# start year or date?
.Persistence(x, start = 1999, end = 2000)
.Persistence(x, dates = 1997:2004, time_dim = 'time', start = 1999, end = 2000)
res <- .Persistence(x, dates = 1997:2004, time_dim = 'time', start = 1999, end = 2000, memb = 10)
str(res)
dim(res$persistence)
dates <- c(seq(ISOdate(1997, 1, 1), ISOdate(2003, 12, 31), "days"))
res <- .Persistence(x = 1:length(dates), dates = dates, time_dim = 'time',
                    start = ISOdate(1998, 1, 1),
                    end = ISOdate(1999, 12, 31), memb = 10)



