View source: R/series_to_mvgam.R
series_to_mvgam | R Documentation |
xts
or ts
objects)
to the format necessary for mvgam
This function converts univariate or multivariate time series (xts
or ts
objects)
to the format necessary for mvgam
series_to_mvgam(series, freq, train_prop = 0.85)
series |
|
freq |
|
train_prop |
|
A list
object containing outputs needed for mvgam
,
including 'data_train' and 'data_test'
# A ts object example
data("sunspots")
series <- cbind(sunspots, sunspots)
colnames(series) <- c('blood', 'bone')
head(series)
series_to_mvgam(series, frequency(series), 0.85)
# An xts object example
library(xts)
dates <- seq(as.Date("2001-05-01"), length=30, by="quarter")
data <- cbind(c(gas = rpois(30, cumprod(1+rnorm(30, mean = 0.01, sd = 0.001)))),
c(oil = rpois(30, cumprod(1+rnorm(30, mean = 0.01, sd = 0.001)))))
series <- xts(x = data, order.by = dates)
colnames(series) <- c('gas', 'oil')
head(series)
series_to_mvgam(series, freq = 4, train_prop = 0.85)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.