Skip to content

NEW NOTEBOOK - counterfactual inference via calculating excess deaths during Covid-19 era #387

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

Closed
wants to merge 44 commits into from

Conversation

drbenvincent
Copy link
Contributor

Hi. This PR contributes a new notebook. The primary topic is calculating excess deaths in England and Wales during the Covid-19 era. The main things of interest are the concepts covered:

  • causal inference
  • linear regression for time-series data
  • Bayesian workflow

Links to Google's Causal Uplift approach are drawn.

Very happy to receive any feedback 🙂

NOTE: it is likely that the checks will fail. I have been having a very hard time with the pre-commit checks. As far as I can work out, there is some auto spelling modification which is applied only to the myst version of the notebook which causes a conflict between the ipynb and myst files. I do not know how to get around this as I have very little experience with commit hooks. I was only able to even commit by bypassing the pre-commit checks with git commit --no-verify.

drbenvincent and others added 30 commits January 24, 2021 16:43
@drbenvincent
Copy link
Contributor Author

I would also suggest separating out the binning notebook into a separate PR.

I'll look into this, I didn't realise I committed any changes to this. It shouldn't be there

@drbenvincent
Copy link
Contributor Author

I would also suggest separating out the binning notebook into a separate PR.

Done. No idea why changes to the binning files got wrapped up in this

@drbenvincent
Copy link
Contributor Author

Tests pass! It's a miracle!

Although it has autocorrected a URL from www.ons.gov.uk/ to www.owns.gov.uk Why are we getting autocorrection on URLs? That seems like madness.

@drbenvincent
Copy link
Contributor Author

Right. This is not going to pass unless I purposefully include the wrong URL, which is not sensible. We need to do something about codespell in the precommit hooks, see #385.

@cluhmann
Copy link
Member

cluhmann commented Jul 2, 2022

Can you try using the full URL? That is, "http://" whatever? This seems so suggest that URLs should be excluded from spell-checking.

@drbenvincent
Copy link
Contributor Author

Can you try using the full URL? That is, "http://" whatever? This seems so suggest that URLs should be excluded from spell-checking.

Odd, I'm already doing that:
Screenshot 2022-07-02 at 19 32 09

@cluhmann
Copy link
Member

cluhmann commented Jul 2, 2022

Or perhaps that's an option that can be enabled on codespell? I didn't look closely.

@drbenvincent
Copy link
Contributor Author

Looks like there are some args:

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
files: myst_nbs/
args: ["--write-changes", "--ignore-words-list", "hist,fpr,fro,lik"]

@cluhmann
Copy link
Member

cluhmann commented Jul 2, 2022

So maybe the solution to the codespell part of #385 is to modify that pre-commit.

@drbenvincent
Copy link
Contributor Author

Yep. Trying to figure out what the correct argument is

@drbenvincent
Copy link
Contributor Author

Think I've got it. I'll create a separate PR to fix the codespell URI stuff

@drbenvincent
Copy link
Contributor Author

Ok. I've filed a separate PR here #388 to fix this.

I initially tried to just edit the precommit file locally. This then does make the local pre-commit checks pass BUT it was not letting me push the changes while the .pre-commit-config.yaml file is unstaged.

So in order to make progress here, we first have to close #388. Then I can rebase or whatever and make progress with this notebook.

@cluhmann
Copy link
Member

cluhmann commented Jul 2, 2022

Yeah, if the only thing holding up this PR is some pre-commit stuff then I think that's probably fine. If we get this PR approved, it will still be blocked until the pre-commit gets fixed. But then this will be automatically unblocked once that happens. So now I guess I can take a look at the actual notebook!

@drbenvincent
Copy link
Contributor Author

Yeah, if the only thing holding up this PR is some pre-commit stuff then I think that's probably fine. If we get this PR approved, it will still be blocked until the pre-commit gets fixed. But then this will be automatically unblocked once that happens. So now I guess I can take a look at the actual notebook!

Happy to get comments on the content. I believe @juanitorduz will have time to provide additional review next week - we're back to needing 2 approving reviewers.

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

juanitorduz commented on 2022-07-04T13:02:19Z
----------------------------------------------------------------

Line #22.        mu = pm.Deterministic(

As we are using a linear model I think it would be nice to scale the data ... maybe through a https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html ?


@juanitorduz
Copy link
Collaborator

@drbenvincent this is a very cool notebook! 🚀 Just left a small comment regarding scaling the data, this of course should not be a blocker to merge it.

It would be great to have a follow up notebook where we allow more complex models like a local linear trend and maybe auto-regressive terms? :)

@drbenvincent
Copy link
Contributor Author

Thanks for everyone's input on this so far. Had some issues with my main branch so life will be simpler switching over to this new PR, #391
I'll close this PR momentarily and do the changes in the new PR

@drbenvincent
Copy link
Contributor Author

It would be great to have a follow up notebook where we allow more complex models like a local linear trend and maybe auto-regressive terms? :)

Yes, I think they could be idea for the future. Perhaps for a more time-series focussed notebook.

@drbenvincent drbenvincent deleted the excess-deaths branch July 4, 2022 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants