business-science/modeltime

Nested forecasting with multiple groups for .id_var

Zuki27 opened this issue · 1 comments

Zuki27 commented

Hello everyone,

Not sure if this has been asked before, but can I nest my time series with a group of variables rather than one?

# Extending each of the time series
    
    
    nested_unbal_fbsaa <- fbsaa_ubal_ts %>% 
      #group_by(symbol) %>% 
      extend_timeseries(
        .id_var = instr_class,sector_label,sector_cpart_label,
        .date_var = quarter,
        .length_future = 4
        ) %>%
      
# Nesting selecting the length of the forecast
      
      
      nest_timeseries(
        .id_var = instr_class,sector_label,sector_cpart_label,
        .length_future = 4,
        .length_actual = 4*4
        ) %>% 
  
# Splitting the data into test and training data sets
    
    split_nested_timeseries(.length_test = 4*2)

I tried it like this but I get an error. I need to group the time series by a group of columns as stated in a snippet of my code above.

Any suggestions?

Make a unique id variable that is the combination of groups.