tidyverts / tidyverts/fabletools

aggregate_key for a linear combination

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
98
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Good morning,

I have been using the excellent fabletools package and I would like to know how to specify a linear combination in a hierarchical time series when using the aggregate_key function. In this simple reproducible example that I simulated I would like to have a TOTAL that is just 0.5FOOD+0.5CORE. Here I post the code:

library(fpp3)

FOOD<-rnorm(100)
CORE<-rnorm(100)
DATE<-yearmonth(seq.Date(from=as.Date("2001-01-01"),by="months",length.out = 100))
DF1<-as_tsibble(tibble(DATE,CORE,FOOD),index="DATE") %>%
pivot_longer(cols = c("CORE","FOOD"),names_to="COMPONENT") %>%
rename(INDEX=value)

DF1 %>%
aggregate_key(COMPONENT,INDEX=sum(INDEX))

#######

I would appreciate any comment.

Thank you very much.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the aggregate_key entry point and reproduce the provided fpp3 example using the simulated CORE and FOOD series. Determine whether a weighted linear combination can be specified, and define what support for TOTAL = 0.5FOOD + 0.5CORE would require. Done means the requested aggregation behavior is supported or its documented limitation is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.