# NOT RUN {
## BREXIT DATA EXAMPLE
## (de Carvalho and Martos, 2018; Fig. 1)
data(brexit)
attach(brexit)
y <- mtsframe(date, brexit[, 1:3] / 100)
fit <- msstc(y)
# Estimations on the simplex
rowSums(fit$trendlines$Y)
# Forecast also in the simplex
rowSums(predict(fit, p = 5)$forecast)
## Window length and components automatically selected
fit$l; fit$m
## Plot trendlines (de Carvalho and Martos, 2018; Fig. 1)
plot(fit, options = list(type = "trendlines"), xlab="time",
col=c("blue", "red", "black"), lwd = 2, lty = c(1, 2, 3))
## Plot cumulative periodograms (with 95% confidence bands)
par(mfrow = c(1, 3))
plot(fit, options = list(type = "cpgrams") )
## Scree-plot (with 95% confidence bands)
par(mfrow = c(1, 1))
plot(fit, options = list(type = "screeplot", ncomp.scree = 1:10),
type = "b", pch = 20, lwd = 2, main='Scree plot')
## Plot elementary reconstructed components
## (de Carvalho and Martos, 2020; Fig. 5)
plot(fit, options = list(type = "components", ncomp = 1:2))
# }
Run the code above in your browser using DataLab