- I have 36 months data and many of the series has leading NAs as not for all the series data is observed from the beginning
I am working on hierarchical time series data and interested in interactions also.
Just to elaborate more - The 2 hierarchies are Geo hierarchy - Area ->Subregion> Subregion ->Subsidiary> Subsidiary and Business HoerarchyHierarchy - Business sector -> Business Sub-sector Requirement is to do the predictions at area level, sector level and also wants to know how the sector A is likely to perform in Area1 After reading the couple of posts on hierarchical time series I got to know that group time series can solve this problem.
But I couldntcouldn't get any examples with code (R) on this, if any sample code is available that would help.
- I have 36 months data starting from Jan-2014 and many of the series data is not observed from Jan-2014 i.e it starts from Aug-2014, July-2015 so I have leading NAs for these series
I have 36 months data starting from Jan-2014 and many of the series data is not observed from Jan-2014 i.e it starts from Aug-2014, July-2015 so I have leading NAs for these series how to handle it as I am getting error in
how to handle it as I am getting error in gts function while executinggts
function while executing - By default it supports only ("ets","arima") models for future predictions - what if I have to use other methods?
By default it supports only ("ets","arima") models for future predictions - what if I have to use other methods?
while using the
accuracy.gts
function getting the- while using the accuracy.gts function getting the error -
Error in
colnames<-
(*tmp*
, value = unlist(labels[levels])) : length of 'dimnames' [2] not equal to array extent
error - Error in
colnames<-
(*tmp*
, value = unlist(labels[levels])) : length of 'dimnames' [2] not equal to array extent- while using the accuracy.gts function getting the error -
Error in
r-code --------enter link description here------------------
library(hts)
data <- read.csv("test_data_gts.csv", header = TRUE)
traning_data <- data[ data$Month_Num<31, -1 ]
gy <- gts(traning_data, characters = list(c(4,4,4),c(5,4)) )
## after removing the columns with leading NAs , I can create the group time series but I dont want to exlude those columns
na_cols <- c()
for( i in 2:dim(traning_data)[2]){
if(any(is.na(traning_data[,i]))){ na_cols <- c( na_cols, i) }
}
traning_data_1 <- traning_data[ , -(na_cols)]
y <- gts(traning_data_1, characters = list(c(4,4,4),c(5,4)) )
## Continued with this series to explore on gts - forecast using forecast.gts
fcast <- forecast(y, h=6, method = "bu",fmethod= "ets" )
holdout_data <- data[data$Month_Num >30, -c(1,na_cols)]
h <- gts(holdout_data,characters = list(c(4,4,4),c(5,4)) )
accuracy.gts(fcast, h ) # gives error - Error in `colnames<-`(`*tmp*`, value = unlist(labels[levels])) : length of 'dimnames' [2] not equal to array extent
Sample data set -