dist_cov

conditional distributions with covariates

https://github.com/mathause/dist_cov

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 31 DOI reference(s) in README
  • Academic publication links
    Links to: springer.com, wiley.com, zenodo.org
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.2%) to scientific vocabulary
Last synced: 7 months ago · JSON representation

Repository

conditional distributions with covariates

Basic Info
  • Host: GitHub
  • Owner: mathause
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 552 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • Open Issues: 4
  • Releases: 1
Created almost 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog License Citation

README.md

Distributions with covariates

DOI

Authors: Mathias Hauser1, Dominik Schumacher1, Sonia I. Seneviratne1

1Institute for Atmospheric and Climate Science, Department of Environmental Systems Science, ETH Zurich, Zurich, Switzerland

Conditional distributions with covariates

:warning: Warning: this package does currently not have any tests.

Approach

We use distributions where one (or more) parameter is dependent on a covariate - e.g. the global mean temperature ($T_{glob}$). for the normal distribution model the mean ($\mu$) and standard deviation ($\sigma$) as follows:

$\mu' = \beta0 + \beta1 * T_{glob}$

$\sigma' = \sigma$

As no such distribution is available in python we adapt distributions in scipy (e.g. scipy.stats.norm).

Markov chain Monte Carlo (MCMC) sampler

The parameter uncertainty is estimated with emcee - an MCMC sampler - see dist_cov.sample.run_mcmc. Also check it's website for a good overview. Of course any other MCMCM sampler can be used as well.

I usually describe this as follows: "We calculate uncertainties in a Bayesian setting and use a Markov Chain MonteCarlo (MCMC) sampler that is affine-transformation invariant (Goodman & Weare, 2010; Foreman-Mackey et al., 2013) to estimate the parameters of the distributions. Starting from non-informative priors, the converged posterior distributions (50,000* non-independent samples) give an estimate of the parameter uncertainty.

* Not all priors are non-informative (i.e. when setting a constrain in dist_cov.distributions.gev_cov)!

** This is n_walker * production in dist_cov.sample.run_mcmc

Installation

Dependencies

dist_cov depends on the python packages emcee, numpy, and scipy. To run the examples corner.py, matplotlib, and xarray are required as well.

Install development version

dist_cov is not available from pypi or conda-forge, therefore it needs to be installed using pip directly from github.

bash pip install git+https://github.com/mathause/dist_cov

To run the examples also install:

bash pip install corner matplotlib xarray

Install latest released version

Go to the newest release on github, copy the URL of the *.tar.gz source file at the botton and then use pip to install it (i.e., pip install ...).

Documentation

Documentation is sparse, but check the examples.

Citing dist_cov

Please cite Hauser et al. (2017) or 10.5281/zenodo.7922001 if you are using dist_cov.

If you use emcee also consider citing Foreman-Mackey et al. (2013) and/ or Goodman & Weare (2010).

History

This code was originally developed for Hauser et al. (2017) based on the approach described in Coles (2001; Chapter 3). It has been employed in several rapid attribution studies under the auspices of the world weather attribution group, namely: - Siberian heatwave of 2020 (Ciavarella et al., 2020 and Ciavarella et al., 2021) - Western North American heat wave of 2021 (Philip et al., 2021 and Philip et al., 2022) - Indian heat wave of 2022 (Zachariah, et al., 2022 and Zachariah et al., in review) - UK heatwave of 2022 (Zachariah et al. 2022) - Northern Hemisphere droughts of 2022 (Schumacher et al., 2022 and Schumacher et al., in review)

It further builds the starting point for modelling extremes in MESMER-X (Quilcaille et al., 2022).

Changelog

See CHANGELOG.md.

License

This project is published under a MIT license.

References

  • Ciavarella, A., Cotterill, D., Stott, P., ... Hauser, M., et al. Prolonged Siberian heat of 2020 almost impossible without human influence. Climatic Change 166, 9 (2021). https://doi.org/10.1007/s10584-021-03052-w
  • Coles, S. (2001), An Introduction to Statistical Modeling of Extreme Values, vol. 208, Springer, London.
  • Foreman-Mackey, D., Hogg, D. W., Lang, D., & Goodman, J. (2013). emcee: The MCMC hammer.Publications of the Astronomical Society ofthe Pacific,125, 306–312. https://doi.org/10.1086/67006
  • Goodman, J., & Weare, J. (2010). Ensemble samplers with affine invariance.Communications in Applied Mathematics and ComputationalScience,5(1), 65–80. https://doi.org/10.2140/camcos.2010.5.6
  • Hauser, M., Gudmundsson, L., Orth, R., Jézéquel, A., Haustein, K., Vautard, R., van Oldenborgh, G.J., Wilcox, L. and Seneviratne, S.I. (2017), Methods and Model Dependency of Extreme Event Attribution: The 2015 European Drought. Earth's Future, 5: 1034-1043. https://doi.org/10.1002/2017EF000612
  • Philip, S. Y., Kew, S. F., van Oldenborgh, G. J., Anslow, F. S., Seneviratne, S. I., Vautard, R., Coumou, D., Ebi, K. L., Arrighi, J., Singh, R., van Aalst, M., Pereira Marghidan, C., Wehner, M., Yang, W., Li, S., Schumacher, D. L., Hauser, M., Bonnet, R., Luu, L. N., Lehner, F., Gillett, N., Tradowsky, J. S., Vecchi, G. A., Rodell, C., Stull, R. B., Howard, R., and Otto, F. E. L.: Rapid attribution analysis of the extraordinary heat wave on the Pacific coast of the US and Canada in June 2021, Earth Syst. Dynam., 13, 1689–1713, https://doi.org/10.5194/esd-13-1689-2022, 2022.
  • Quilcaille, Y., Gudmundsson, L., Beusch, L., Hauser, M., & Seneviratne, S. I. (2022). Showcasing MESMER-X: Spatially resolved emulation of annual maximum temperatures of Earth System Models. Geophysical Research Letters, 49, e2022GL099012. https://doi.org/10.1029/2022GL099012

Owner

  • Name: Mathias Hauser
  • Login: mathause
  • Kind: user
  • Location: Zurich, Switzerland
  • Company: IAC @ ETH Zurich

GitHub Events

Total
  • Delete event: 1
Last Year
  • Delete event: 1

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 34
  • Total Committers: 1
  • Avg Commits per committer: 34.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Mathias Hauser m****r@e****h 34
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 5
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mathause (4)
Pull Request Authors
  • mathause (1)
Top Labels
Issue Labels
Pull Request Labels