knitr::opts_chunk$set(echo = TRUE) devtools::install_github("aefdz/nnFTS", dep = FALSE) library("nnFTS")
data(sinedata) focal <- '1' dist <- 'l2' # dist<-'supremum' plot <- TRUE resultsBand <- envelope(sinedata, focal, dist, plot) resultsBand #Envelope
kcurves <- 10 # number of curves of the envelope involved in the band dataPartially <- rainbow::fds(sinedata$x[1:25], sinedata$y[1:25,]) results <- envelope(dataPartially, focal, dist, plot = FALSE) pl <- plotBand(sinedata, focal, results$Jordered, kcurves, cut = 25)
manipulate( { plotBand(sinedata, focal, results$Jordered, kcurves) }, kcurves = slider(min = 1, max = length(results$Jordered), step = 1, ticks = TRUE), cut = slider(1, 99, initial = 50, step = 1) )
data(electricityDemand) focal <- "saturday/29/12/2018" data <- rainbow::fts(electricityDemand$x, electricityDemand$y[,1:1825]) point <- envelope.forecast(data, focal, h = 1, distance = "l2", typePoint = "expw", theta = 1) plot(data, col = "grey50") lines(data$x, point, col = "red") lines(electricityDemand$x, electricityDemand$y[,"sunday/30/12/2018"], col = "blue")
data(electricityDemand) # DU half day focal <- "monday/31/12/2018" data <- electricityDemand data$y[72:144, focal] <- NA point <- envelope.forecast(data, focal, h = 1, distance = "l2", typePoint = "expw", theta = 1) plot(data, col = "grey50") lines(data$x, point, col = "red") lines(data$x, electricityDemand$y[,"monday/31/12/2018"], col = "blue") abline(v = data$x[72])
data(electricityDemand) focal <- "saturday/29/12/2018" data <- rainbow::fts(electricityDemand$x, electricityDemand$y[,1:1825]) point <- fknn.forecast(data, focal, k = 3, h = 1, distance = "l2", typePoint = "expw", theta = 1) plot(data, col = "grey50") lines(data$x, point, col = "red") lines(electricityDemand$x, electricityDemand$y[,"sunday/30/12/2018"], col = "blue")
data(electricityDemand) # DU half day focal <- "monday/31/12/2018" data <- electricityDemand data$y[72:144, focal] <- NA point <- fknn.forecast(data, focal, k = 3, h = 1, distance = "l2", typePoint = "expw", theta = 1) plot(data, col = "grey50") lines(data$x, point, col = "red") lines(data$x, electricityDemand$y[,"monday/31/12/2018"], col = "blue") abline(v = data$x[72])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.