Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day-of-week effect #14

Closed
4 tasks
ghost opened this issue Mar 8, 2024 · 3 comments · Fixed by #158
Closed
4 tasks

Day-of-week effect #14

ghost opened this issue Mar 8, 2024 · 3 comments · Fixed by #158
Assignees
Labels
documentation Improvements or additions to documentation model related to models created using pyrenew

Comments

@ghost
Copy link

ghost commented Mar 8, 2024

Goal

We want to have a single source of truth for the mathematical formulation of the day of week effect on the hospital admissions (and/or ED visits). We want to be able to use this to immediately code up the math decided upon here.

Context

This was discussed in the 2024-02-27 meeting (see minutes) and agreed upon in the ADR record under model_features.md. This specific feature should be the same as what's implemented in the existing wastewater model. Completion of this task will allow us to implement the feature more quickly and should facilitate creation of a model design document.

Required features

  • mathematical description of the day of week effect applied to the hospital admissions and/or ED visit signals
  • add to the feature to the model design document
  • Include an independent test that checks TBD.
  • Include documentation in the code using docstring

Out of scope

  • This does not include code, just specification of the feature in math/writing

Related documents

Ref: https://github.com/cdcent/cfa-multisignal-renewal/issues/75
author: @kaitejohnson

@ghost ghost added documentation Improvements or additions to documentation development task model related to models created using pyrenew labels Mar 8, 2024
@dylanhmorris dylanhmorris added this to the Backlog milestone Mar 21, 2024
@damonbayer damonbayer modified the milestones: Backlog, K Sprint May 24, 2024
@damonbayer damonbayer modified the milestones: 🦩 Kakuru, L Sprint Jun 10, 2024
@damonbayer
Copy link
Collaborator

damonbayer commented Jun 11, 2024

I like where #158 is heading. The problem is that we do not currently reproduce "the existing wastewater model," as is mentioned in the description.

In that model, the weekday effects are constrained so that "the seven values that $\omega(t)$ takes on are constrained to have mean 1." This isn't quite accurate. $\omega(t)$ is implemented as a 7-simplex (sum = 1, mean = 1/7) which is multiplied by 7 (sum = 7, mean = 1). See https://github.com/CDCgov/wastewater-informed-covid-forecasting/blob/prod/model_definition.md#hospital-admissions-component

I would like to generalize like you are doing with PeriodicBroadcaster so we would have something implemented a $n$-simplex multiplied by $n$.

@dylanhmorris has some idea about implementing this with glmprediction, which he will comment today.

@dylanhmorris
Copy link
Collaborator

@dylanhmorris has some idea about implementing this with glmprediction, which he will comment today.

On reflection, I do not think this is the way to go for now. I think the most numerically stable and readable reimplementation of the existing model will frame this explicitly as sampling from the 7-simplex with the appropriate prior.

@gvegayon
Copy link
Member

As @dylanhmorris suggests, I think the prior solves it. We can sample from a Dirichlet and use an affine transform to get there:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation model related to models created using pyrenew
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants