Skip to content

create_lags_and_leads updates and refactors #12

@dshemetov

Description

@dshemetov

I spoke to @ElenaTuzhilina about her forecasting work and the structures she likes to use in her work. She drew this helpful diagram of a function similar to create_lags_and_leads that generates model matrices. It also provides an info matrix that acts as an index for the model matrices. I don't have much experience using the current create_lags_and_leads, but it doesn't seem too far from what is currently offered. I am labeling this issue as an enhancement from user feedback and would like to open discussion with the rest of the team on whether this is something that would help others too.

image

If this addition is not too controversial, perhaps we can also discuss refactoring create_lags_and_leads here. Our last sync meeting had the following points:

  • the dplyr transformations are quite complicated and difficult to understand
    • consider doing imputation separately and then use dplyr::lag() or dplyr::lead() instead?
    • this code may be inevitably complex due to the different edge cases it needs to handle: a) positive/negative lags, b) imputation of missing and NA values (see Logan’s example)
  • we should test the speed of the full_join, maybe using profvis

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions