diff --git a/docs/build/html/_sources/msei_reference/model.rst.txt b/docs/build/html/_sources/msei_reference/model.rst.txt
index d430154c..21109cc4 100644
--- a/docs/build/html/_sources/msei_reference/model.rst.txt
+++ b/docs/build/html/_sources/msei_reference/model.rst.txt
@@ -1,10 +1,10 @@
MSEI Model
==========
-Hospitalizations
-----------------
+Hospital Admissions
+-------------------
-.. automodule:: pyrenew.model.hospitalizations
+.. automodule:: pyrenew.model.admissionsmodel
:members:
:undoc-members:
:show-inheritance:
@@ -12,7 +12,7 @@ Hospitalizations
Reproduction Number Renewal Infections
--------------------------------------
-.. automodule:: pyrenew.model.rtinfectionsrenewal
+.. automodule:: pyrenew.model.rtinfectionsrenewalmodel
:members:
:undoc-members:
:show-inheritance:
diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js
index 36da806e..9d4dc6ae 100644
--- a/docs/build/html/searchindex.js
+++ b/docs/build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"docnames": ["general/ctoc", "index", "msei_reference/index", "msei_reference/observation", "msei_reference/process"], "filenames": ["general/ctoc.rst", "index.rst", "msei_reference/index.rst", "msei_reference/observation.rst", "msei_reference/process.rst"], "titles": ["Complete Table Of Contents", "CFA Multisignal Renewal Documentation", "MSEI Reference", "Observation Processes", "Process MSEI"], "terms": {"msei": [0, 1], "refer": [0, 1], "observ": [0, 2], "process": [0, 2], "neg": [0, 2], "binomi": [0, 2], "negativebinomialobserv": [0, 2, 3], "poisson": [0, 2], "poissonobserv": [0, 2, 3], "ar": [0, 2], "arprocess": [0, 2, 4], "first": [0, 2], "differ": [0, 2], "firstdifferencearprocess": [0, 2, 4], "reproduct": [0, 2], "number": [0, 2], "random": [0, 2], "walk": [0, 2], "rtrandomwalkprocess": [0, 2, 4], "simpl": [0, 2], "simplerandomwalkprocess": [0, 2, 4], "latent": [0, 2], "compon": [0, 2], "hospit": [0, 2], "admiss": [0, 2], "hospadmissionssampl": [0, 2], "hospitaladmiss": [0, 2], "infect": [0, 2], "infectionssampl": [0, 2], "function": [0, 2], "logistic_susceptibility_adjust": [0, 2], "sample_infections_rt": [0, 2], "sample_infections_with_feedback": [0, 2], "model": [0, 1, 2], "hospmodelsampl": [0, 2], "hospitalizationsmodel": [0, 2], "renew": [0, 2], "rtinfectionsrenewalmodel": [0, 2], "rtinfectionsrenewalsampl": [0, 2], "gener": [0, 2, 4], "support": [0, 2], "metaclass": [0, 2], "modul": [0, 1, 2, 3, 4], "kernel": [0, 2], "mcmc": [0, 2], "print_summari": [0, 2], "run": [0, 2], "sampl": [0, 2, 3, 4], "spread_draw": [0, 2], "valid": [0, 2, 3, 4], "randomvari": [0, 2, 3, 4], "convolut": [0, 2], "util": [0, 2], "new_convolve_scann": [0, 2], "new_double_scann": [0, 2], "mathemat": [0, 2], "get_asymptotic_growth_r": [0, 2], "get_asymptotic_growth_rate_and_age_dist": [0, 2], "get_leslie_matrix": [0, 2], "get_stable_age_distribut": [0, 2], "transform": [0, 2, 4], "abstracttransform": [0, 2, 4], "identitytransform": [0, 2], "logtransform": [0, 2, 4], "logittransform": [0, 2], "scaledlogittransform": [0, 2], "regress": [0, 2], "abstractregressionpredict": [0, 2], "glmpredict": [0, 2], "distribut": [0, 2, 3, 4], "reverse_discrete_dist_vector": [0, 2], "validate_discrete_dist_vector": [0, 2], "test": [0, 1], "test_ar_can_be_sampl": 0, "test_fd_ar_can_be_sampl": 0, "logist": 0, "suscept": 0, "test_logistic_susceptibility_adjust": 0, "test_rw_can_be_sampl": 0, "test_rw_samples_correctly_distribut": 0, "asymptomat": 0, "test_asymptotic_properti": 0, "generic_inversion_test": 0, "test_invert_dist": 0, "test_glm_predict": 0, "lesli": 0, "matrix": 0, "test_get_lesli": 0, "index": [0, 1, 2], "search": [0, 1], "page": [0, 1, 2], "faq": [0, 1, 2], "glossari": [0, 1], "licens": [0, 1, 2], "other": [0, 1], "notic": [0, 1, 2], "disclaim": 0, "public": 0, "domain": 0, "standard": 0, "privaci": 0, "record": 0, "manag": 0, "addit": 0, "final": 0, "note": 0, "state": [0, 1, 2], "develop": [0, 1, 2], "setup": [0, 1, 2], "usag": [0, 1, 2], "contribut": [0, 1, 2], "To": [0, 1], "report": [0, 1, 2], "issu": [0, 1, 2], "goal": 0, "context": 0, "requir": 0, "featur": 0, "specif": 0, "out": 0, "scope": 0, "relat": 0, "document": [0, 2], "chang": [0, 2, 4], "order": [0, 2, 3, 4], "name": [0, 2, 4], "toctre": [0, 2], "entiti": [0, 2], "welcom": 1, "": [1, 4], "epidemiolog": 1, "infer": [1, 2], "project": 1, "k": 1, "signal": 1, "fusion": 1, "which": [1, 3], "consist": 1, "an": [1, 4], "intern": 1, "forecast": 1, "leverag": 1, "multipl": 1, "data": 1, "sourc": [1, 2, 3, 4], "enhanc": 1, "infecti": 1, "diseas": 1, "outbreak": 1, "thi": 1, "repositori": 1, "i": [1, 2, 3, 4], "compos": 1, "two": 1, "part": 1, "folder": [1, 2], "analysi": 1, "pipelin": 1, "overview": 1, "follow": 1, "Of": [1, 2], "complet": 1, "content": 1, "have": [1, 2], "doc": [1, 2], "exist": [1, 2], "main": [1, 2], "deploi": [1, 2], "us": [1, 2], "gha": [1, 2], "add": [1, 2], "help": [1, 2], "tutori": [1, 2], "howto": [1, 2], "about": [1, 2], "histori": [1, 2], "download": [1, 2], "copyright": [1, 2], "get": 2, "baselin": 2, "accur": 2, "version": 2, "The": 2, "origin": 2, "entri": 2, "locat": 2, "user": 2, "trevormartin": 2, "github": 2, "multisign": 2, "epi": 2, "bug": 2, "rst": 2, "line": 2, "52": 2, "10": 2, "frequent": 2, "ask": 2, "question": 2, "6": 2, "17": 2, "37": 2, "determin": [2, 3, 4], "msei_refer": 2, "28": 2, "20": 2, "61": 2, "ctoc": 2, "21": 2, "87": 2, "89": 2, "meta": 2, "inform": 2, "91": 2, "abov": 2, "15": 2, "36": 2, "class": [3, 4], "pyrenew": [3, 4], "negativebinomi": 3, "concentration_prior": 3, "_supportsarrai": [3, 4], "dtype": [3, 4], "ani": [3, 4], "_nestedsequ": [3, 4], "bool": [3, 4], "int": [3, 4], "float": [3, 4], "complex": [3, 4], "str": [3, 4], "byte": [3, 4], "concentration_suffix": 3, "_concentr": 3, "parameter_nam": 3, "negbinom_rv": 3, "mean_varnam": 3, "mean": [3, 4], "counts_varnam": 3, "count": 3, "base": [3, 4], "random_vari": [3, 4], "dict": [3, 4], "constant": [3, 4], "none": [3, 4], "tupl": [3, 4], "from": [3, 4], "paramet": [3, 4], "option": [3, 4], "A": [3, 4], "dictionari": [3, 4], "contain": [3, 4], "possibli": 3, "pass": [3, 4], "ob": 3, "numpyro": [3, 4], "ignor": 3, "default": [3, 4], "return": [3, 4], "type": [3, 4], "static": [3, 4], "poisson_rv": 3, "rate_varnam": 3, "rate": [3, 4], "ep": 3, "1e": 3, "08": 3, "possibl": 3, "autoreg": 4, "noise_sd": 4, "object": 4, "repres": 4, "p": 4, "durat": 4, "init": 4, "length": 4, "sequenc": 4, "arraylik": 4, "initi": 4, "point": 4, "firstdifferencear": 4, "stochast": 4, "1": 4, "e": 4, "init_v": 4, "init_rate_of_chang": 4, "trend_rw": 4, "start": 4, "rtrandomwalk": 4, "rt0_dist": 4, "truncat": 4, "lefttruncateddistribut": 4, "rt_transform": 4, "rt_rw_dist": 4, "continu": 4, "normal": 4, "rt": 4, "randomwalk": 4, "rt0": 4, "n_timepoint": 4, "simplerandomwalk": 4, "error_distribut": 4, "markovian": 4, "arbitrari": 4, "step": 4}, "objects": {"pyrenew.observation": [[3, 0, 0, "-", "negativebinomial"], [3, 0, 0, "-", "poisson"]], "pyrenew.observation.negativebinomial": [[3, 1, 1, "", "NegativeBinomialObservation"]], "pyrenew.observation.negativebinomial.NegativeBinomialObservation": [[3, 2, 1, "", "sample"], [3, 2, 1, "", "validate"]], "pyrenew.observation.poisson": [[3, 1, 1, "", "PoissonObservation"]], "pyrenew.observation.poisson.PoissonObservation": [[3, 2, 1, "", "sample"], [3, 2, 1, "", "validate"]], "pyrenew.process": [[4, 0, 0, "-", "ar"], [4, 0, 0, "-", "firstdifferencear"], [4, 0, 0, "-", "rtrandomwalk"], [4, 0, 0, "-", "simplerandomwalk"]], "pyrenew.process.ar": [[4, 1, 1, "", "ARProcess"]], "pyrenew.process.ar.ARProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.firstdifferencear": [[4, 1, 1, "", "FirstDifferenceARProcess"]], "pyrenew.process.firstdifferencear.FirstDifferenceARProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.rtrandomwalk": [[4, 1, 1, "", "RtRandomWalkProcess"]], "pyrenew.process.rtrandomwalk.RtRandomWalkProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.simplerandomwalk": [[4, 1, 1, "", "SimpleRandomWalkProcess"]], "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"]}, "titleterms": {"complet": 0, "tabl": [0, 1], "Of": 0, "content": 0, "todo": [0, 1, 2, 3, 4], "cfa": 1, "multisign": 1, "renew": 1, "document": 1, "compon": 1, "indic": 1, "And": 1, "meta": 1, "inform": 1, "msei": [2, 4], "refer": 2, "observ": 3, "process": [3, 4], "neg": 3, "binomi": 3, "poisson": 3, "ar": 4, "first": 4, "differ": 4, "reproduct": 4, "number": 4, "random": 4, "walk": 4, "simpl": 4}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.viewcode": 1, "sphinx": 60}, "alltitles": {"Complete Table Of Contents": [[0, "complete-table-of-contents"]], "Todo": [[0, "id1"], [1, "id1"], [1, "id2"], [1, "id3"], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, "id1"], [3, "id1"], [4, "id1"]], "CFA Multisignal Renewal Documentation": [[1, "cfa-multisignal-renewal-documentation"]], "Documentation Components": [[1, "documentation-components"]], "Indices And Tables": [[1, "indices-and-tables"]], "Meta Information": [[1, "meta-information"]], "MSEI Reference": [[2, "msei-reference"]], "Observation Processes": [[3, "observation-processes"]], "Negative Binomial": [[3, "module-pyrenew.observation.negativebinomial"]], "Poisson": [[3, "module-pyrenew.observation.poisson"]], "Process MSEI": [[4, "process-msei"]], "AR Processes": [[4, "module-pyrenew.process.ar"]], "First Difference (AR)": [[4, "module-pyrenew.process.firstdifferencear"]], "Reproduction Number Random Walk": [[4, "module-pyrenew.process.rtrandomwalk"]], "Simple Random Walk": [[4, "module-pyrenew.process.simplerandomwalk"]]}, "indexentries": {"negativebinomialobservation (class in pyrenew.observation.negativebinomial)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation"]], "poissonobservation (class in pyrenew.observation.poisson)": [[3, "pyrenew.observation.poisson.PoissonObservation"]], "module": [[3, "module-pyrenew.observation.negativebinomial"], [3, "module-pyrenew.observation.poisson"], [4, "module-pyrenew.process.ar"], [4, "module-pyrenew.process.firstdifferencear"], [4, "module-pyrenew.process.rtrandomwalk"], [4, "module-pyrenew.process.simplerandomwalk"]], "pyrenew.observation.negativebinomial": [[3, "module-pyrenew.observation.negativebinomial"]], "pyrenew.observation.poisson": [[3, "module-pyrenew.observation.poisson"]], "sample() (pyrenew.observation.negativebinomial.negativebinomialobservation method)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation.sample"]], "sample() (pyrenew.observation.poisson.poissonobservation method)": [[3, "pyrenew.observation.poisson.PoissonObservation.sample"]], "validate() (pyrenew.observation.negativebinomial.negativebinomialobservation static method)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation.validate"]], "validate() (pyrenew.observation.poisson.poissonobservation static method)": [[3, "pyrenew.observation.poisson.PoissonObservation.validate"]], "arprocess (class in pyrenew.process.ar)": [[4, "pyrenew.process.ar.ARProcess"]], "firstdifferencearprocess (class in pyrenew.process.firstdifferencear)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess"]], "rtrandomwalkprocess (class in pyrenew.process.rtrandomwalk)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess"]], "simplerandomwalkprocess (class in pyrenew.process.simplerandomwalk)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess"]], "pyrenew.process.ar": [[4, "module-pyrenew.process.ar"]], "pyrenew.process.firstdifferencear": [[4, "module-pyrenew.process.firstdifferencear"]], "pyrenew.process.rtrandomwalk": [[4, "module-pyrenew.process.rtrandomwalk"]], "pyrenew.process.simplerandomwalk": [[4, "module-pyrenew.process.simplerandomwalk"]], "sample() (pyrenew.process.ar.arprocess method)": [[4, "pyrenew.process.ar.ARProcess.sample"]], "sample() (pyrenew.process.firstdifferencear.firstdifferencearprocess method)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess.sample"]], "sample() (pyrenew.process.rtrandomwalk.rtrandomwalkprocess method)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess.sample"]], "sample() (pyrenew.process.simplerandomwalk.simplerandomwalkprocess method)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess.sample"]], "validate() (pyrenew.process.ar.arprocess static method)": [[4, "pyrenew.process.ar.ARProcess.validate"]], "validate() (pyrenew.process.firstdifferencear.firstdifferencearprocess static method)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess.validate"]], "validate() (pyrenew.process.rtrandomwalk.rtrandomwalkprocess static method)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess.validate"]], "validate() (pyrenew.process.simplerandomwalk.simplerandomwalkprocess static method)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess.validate"]]}})
+Search.setIndex({"docnames": ["general/ctoc", "index", "msei_reference/index", "msei_reference/observation", "msei_reference/process"], "filenames": ["general/ctoc.rst", "index.rst", "msei_reference/index.rst", "msei_reference/observation.rst", "msei_reference/process.rst"], "titles": ["Complete Table Of Contents", "CFA Multisignal Renewal Documentation", "MSEI Reference", "Observation Processes", "Process MSEI"], "terms": {"msei": [0, 1], "refer": [0, 1], "observ": [0, 2], "process": [0, 2], "neg": [0, 2], "binomi": [0, 2], "negativebinomialobserv": [0, 2, 3], "poisson": [0, 2], "poissonobserv": [0, 2, 3], "ar": [0, 2], "arprocess": [0, 2, 4], "first": [0, 2], "differ": [0, 2], "firstdifferencearprocess": [0, 2, 4], "reproduct": [0, 2], "number": [0, 2], "random": [0, 2], "walk": [0, 2], "rtrandomwalkprocess": [0, 2, 4], "simpl": [0, 2], "simplerandomwalkprocess": [0, 2, 4], "latent": [0, 2], "compon": [0, 2], "hospit": [0, 2], "admiss": [0, 2], "hospadmissionssampl": [0, 2], "hospitaladmiss": [0, 2], "infect": [0, 2], "infectionssampl": [0, 2], "function": [0, 2], "logistic_susceptibility_adjust": [0, 2], "sample_infections_rt": [0, 2], "sample_infections_with_feedback": [0, 2], "model": [0, 1, 2], "hospmodelsampl": [0, 2], "hospitaladmissionsmodel": [0, 2], "renew": [0, 2], "rtinfectionsrenewalmodel": [0, 2], "rtinfectionsrenewalsampl": [0, 2], "gener": [0, 2, 4], "support": [0, 2], "metaclass": [0, 2], "modul": [0, 1, 2, 3, 4], "kernel": [0, 2], "mcmc": [0, 2], "print_summari": [0, 2], "run": [0, 2], "sampl": [0, 2, 3, 4], "spread_draw": [0, 2], "valid": [0, 2, 3, 4], "randomvari": [0, 2, 3, 4], "convolut": [0, 2], "util": [0, 2], "new_convolve_scann": [0, 2], "new_double_scann": [0, 2], "mathemat": [0, 2], "get_asymptotic_growth_r": [0, 2], "get_asymptotic_growth_rate_and_age_dist": [0, 2], "get_leslie_matrix": [0, 2], "get_stable_age_distribut": [0, 2], "transform": [0, 2, 4], "abstracttransform": [0, 2, 4], "identitytransform": [0, 2], "logtransform": [0, 2, 4], "logittransform": [0, 2], "scaledlogittransform": [0, 2], "regress": [0, 2], "abstractregressionpredict": [0, 2], "glmpredict": [0, 2], "distribut": [0, 2, 3, 4], "reverse_discrete_dist_vector": [0, 2], "validate_discrete_dist_vector": [0, 2], "test": [0, 1], "test_ar_can_be_sampl": 0, "test_fd_ar_can_be_sampl": 0, "logist": 0, "suscept": 0, "test_logistic_susceptibility_adjust": 0, "test_rw_can_be_sampl": 0, "test_rw_samples_correctly_distribut": 0, "asymptomat": 0, "test_asymptotic_properti": 0, "generic_inversion_test": 0, "test_invert_dist": 0, "test_glm_predict": 0, "lesli": 0, "matrix": 0, "test_get_lesli": 0, "index": [0, 1, 2], "search": [0, 1], "page": [0, 1, 2], "faq": [0, 1, 2], "glossari": [0, 1], "licens": [0, 1, 2], "other": [0, 1], "notic": [0, 1, 2], "disclaim": 0, "public": 0, "domain": 0, "standard": 0, "privaci": 0, "record": 0, "manag": 0, "addit": 0, "final": 0, "note": 0, "state": [0, 1, 2], "develop": [0, 1, 2], "setup": [0, 1, 2], "usag": [0, 1, 2], "contribut": [0, 1, 2], "To": [0, 1], "report": [0, 1, 2], "issu": [0, 1, 2], "goal": 0, "context": 0, "requir": 0, "featur": 0, "specif": 0, "out": 0, "scope": 0, "relat": 0, "document": [0, 2], "chang": [0, 2, 4], "order": [0, 2, 3, 4], "name": [0, 2, 4], "toctre": [0, 2], "entiti": [0, 2], "welcom": 1, "": [1, 4], "epidemiolog": 1, "infer": [1, 2], "project": 1, "k": 1, "signal": 1, "fusion": 1, "which": [1, 3], "consist": 1, "an": [1, 4], "intern": 1, "forecast": 1, "leverag": 1, "multipl": 1, "data": 1, "sourc": [1, 2, 3, 4], "enhanc": 1, "infecti": 1, "diseas": 1, "outbreak": 1, "thi": 1, "repositori": 1, "i": [1, 2, 3, 4], "compos": 1, "two": 1, "part": 1, "folder": [1, 2], "analysi": 1, "pipelin": 1, "overview": 1, "follow": 1, "Of": [1, 2], "complet": 1, "content": 1, "have": [1, 2], "doc": [1, 2], "exist": [1, 2], "main": [1, 2], "deploi": [1, 2], "us": [1, 2], "gha": [1, 2], "add": [1, 2], "help": [1, 2], "tutori": [1, 2], "howto": [1, 2], "about": [1, 2], "histori": [1, 2], "download": [1, 2], "copyright": [1, 2], "get": 2, "baselin": 2, "accur": 2, "version": 2, "The": 2, "origin": 2, "entri": 2, "locat": 2, "user": 2, "trevormartin": 2, "github": 2, "multisign": 2, "epi": 2, "bug": 2, "rst": 2, "line": 2, "52": 2, "10": 2, "frequent": 2, "ask": 2, "question": 2, "6": 2, "17": 2, "37": 2, "determin": [2, 3, 4], "msei_refer": 2, "28": 2, "20": 2, "61": 2, "ctoc": 2, "21": 2, "87": 2, "89": 2, "meta": 2, "inform": 2, "91": 2, "abov": 2, "15": 2, "36": 2, "class": [3, 4], "pyrenew": [3, 4], "negativebinomi": 3, "concentration_prior": 3, "_supportsarrai": [3, 4], "dtype": [3, 4], "ani": [3, 4], "_nestedsequ": [3, 4], "bool": [3, 4], "int": [3, 4], "float": [3, 4], "complex": [3, 4], "str": [3, 4], "byte": [3, 4], "concentration_suffix": 3, "_concentr": 3, "parameter_nam": 3, "negbinom_rv": 3, "mean_varnam": 3, "mean": [3, 4], "counts_varnam": 3, "count": 3, "base": [3, 4], "random_vari": [3, 4], "dict": [3, 4], "constant": [3, 4], "none": [3, 4], "tupl": [3, 4], "from": [3, 4], "paramet": [3, 4], "option": [3, 4], "A": [3, 4], "dictionari": [3, 4], "contain": [3, 4], "possibli": 3, "pass": [3, 4], "ob": 3, "numpyro": [3, 4], "ignor": 3, "default": [3, 4], "return": [3, 4], "type": [3, 4], "static": [3, 4], "poisson_rv": 3, "rate_varnam": 3, "rate": [3, 4], "ep": 3, "1e": 3, "08": 3, "possibl": 3, "autoreg": 4, "noise_sd": 4, "object": 4, "repres": 4, "p": 4, "durat": 4, "init": 4, "length": 4, "sequenc": 4, "arraylik": 4, "initi": 4, "point": 4, "firstdifferencear": 4, "stochast": 4, "1": 4, "e": 4, "init_v": 4, "init_rate_of_chang": 4, "trend_rw": 4, "start": 4, "rtrandomwalk": 4, "rt0_dist": 4, "truncat": 4, "lefttruncateddistribut": 4, "rt_transform": 4, "rt_rw_dist": 4, "continu": 4, "normal": 4, "rt": 4, "randomwalk": 4, "rt0": 4, "n_timepoint": 4, "simplerandomwalk": 4, "error_distribut": 4, "markovian": 4, "arbitrari": 4, "step": 4}, "objects": {"pyrenew.observation": [[3, 0, 0, "-", "negativebinomial"], [3, 0, 0, "-", "poisson"]], "pyrenew.observation.negativebinomial": [[3, 1, 1, "", "NegativeBinomialObservation"]], "pyrenew.observation.negativebinomial.NegativeBinomialObservation": [[3, 2, 1, "", "sample"], [3, 2, 1, "", "validate"]], "pyrenew.observation.poisson": [[3, 1, 1, "", "PoissonObservation"]], "pyrenew.observation.poisson.PoissonObservation": [[3, 2, 1, "", "sample"], [3, 2, 1, "", "validate"]], "pyrenew.process": [[4, 0, 0, "-", "ar"], [4, 0, 0, "-", "firstdifferencear"], [4, 0, 0, "-", "rtrandomwalk"], [4, 0, 0, "-", "simplerandomwalk"]], "pyrenew.process.ar": [[4, 1, 1, "", "ARProcess"]], "pyrenew.process.ar.ARProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.firstdifferencear": [[4, 1, 1, "", "FirstDifferenceARProcess"]], "pyrenew.process.firstdifferencear.FirstDifferenceARProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.rtrandomwalk": [[4, 1, 1, "", "RtRandomWalkProcess"]], "pyrenew.process.rtrandomwalk.RtRandomWalkProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]], "pyrenew.process.simplerandomwalk": [[4, 1, 1, "", "SimpleRandomWalkProcess"]], "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess": [[4, 2, 1, "", "sample"], [4, 2, 1, "", "validate"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"]}, "titleterms": {"complet": 0, "tabl": [0, 1], "Of": 0, "content": 0, "todo": [0, 1, 2, 3, 4], "cfa": 1, "multisign": 1, "renew": 1, "document": 1, "compon": 1, "indic": 1, "And": 1, "meta": 1, "inform": 1, "msei": [2, 4], "refer": 2, "observ": 3, "process": [3, 4], "neg": 3, "binomi": 3, "poisson": 3, "ar": 4, "first": 4, "differ": 4, "reproduct": 4, "number": 4, "random": 4, "walk": 4, "simpl": 4}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.viewcode": 1, "sphinx": 60}, "alltitles": {"Complete Table Of Contents": [[0, "complete-table-of-contents"]], "Todo": [[0, "id1"], [1, "id1"], [1, "id2"], [1, "id3"], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, null], [2, "id1"], [3, "id1"], [4, "id1"]], "CFA Multisignal Renewal Documentation": [[1, "cfa-multisignal-renewal-documentation"]], "Documentation Components": [[1, "documentation-components"]], "Indices And Tables": [[1, "indices-and-tables"]], "Meta Information": [[1, "meta-information"]], "MSEI Reference": [[2, "msei-reference"]], "Observation Processes": [[3, "observation-processes"]], "Negative Binomial": [[3, "module-pyrenew.observation.negativebinomial"]], "Poisson": [[3, "module-pyrenew.observation.poisson"]], "Process MSEI": [[4, "process-msei"]], "AR Processes": [[4, "module-pyrenew.process.ar"]], "First Difference (AR)": [[4, "module-pyrenew.process.firstdifferencear"]], "Reproduction Number Random Walk": [[4, "module-pyrenew.process.rtrandomwalk"]], "Simple Random Walk": [[4, "module-pyrenew.process.simplerandomwalk"]]}, "indexentries": {"negativebinomialobservation (class in pyrenew.observation.negativebinomial)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation"]], "poissonobservation (class in pyrenew.observation.poisson)": [[3, "pyrenew.observation.poisson.PoissonObservation"]], "module": [[3, "module-pyrenew.observation.negativebinomial"], [3, "module-pyrenew.observation.poisson"], [4, "module-pyrenew.process.ar"], [4, "module-pyrenew.process.firstdifferencear"], [4, "module-pyrenew.process.rtrandomwalk"], [4, "module-pyrenew.process.simplerandomwalk"]], "pyrenew.observation.negativebinomial": [[3, "module-pyrenew.observation.negativebinomial"]], "pyrenew.observation.poisson": [[3, "module-pyrenew.observation.poisson"]], "sample() (pyrenew.observation.negativebinomial.negativebinomialobservation method)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation.sample"]], "sample() (pyrenew.observation.poisson.poissonobservation method)": [[3, "pyrenew.observation.poisson.PoissonObservation.sample"]], "validate() (pyrenew.observation.negativebinomial.negativebinomialobservation static method)": [[3, "pyrenew.observation.negativebinomial.NegativeBinomialObservation.validate"]], "validate() (pyrenew.observation.poisson.poissonobservation static method)": [[3, "pyrenew.observation.poisson.PoissonObservation.validate"]], "arprocess (class in pyrenew.process.ar)": [[4, "pyrenew.process.ar.ARProcess"]], "firstdifferencearprocess (class in pyrenew.process.firstdifferencear)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess"]], "rtrandomwalkprocess (class in pyrenew.process.rtrandomwalk)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess"]], "simplerandomwalkprocess (class in pyrenew.process.simplerandomwalk)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess"]], "pyrenew.process.ar": [[4, "module-pyrenew.process.ar"]], "pyrenew.process.firstdifferencear": [[4, "module-pyrenew.process.firstdifferencear"]], "pyrenew.process.rtrandomwalk": [[4, "module-pyrenew.process.rtrandomwalk"]], "pyrenew.process.simplerandomwalk": [[4, "module-pyrenew.process.simplerandomwalk"]], "sample() (pyrenew.process.ar.arprocess method)": [[4, "pyrenew.process.ar.ARProcess.sample"]], "sample() (pyrenew.process.firstdifferencear.firstdifferencearprocess method)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess.sample"]], "sample() (pyrenew.process.rtrandomwalk.rtrandomwalkprocess method)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess.sample"]], "sample() (pyrenew.process.simplerandomwalk.simplerandomwalkprocess method)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess.sample"]], "validate() (pyrenew.process.ar.arprocess static method)": [[4, "pyrenew.process.ar.ARProcess.validate"]], "validate() (pyrenew.process.firstdifferencear.firstdifferencearprocess static method)": [[4, "pyrenew.process.firstdifferencear.FirstDifferenceARProcess.validate"]], "validate() (pyrenew.process.rtrandomwalk.rtrandomwalkprocess static method)": [[4, "pyrenew.process.rtrandomwalk.RtRandomWalkProcess.validate"]], "validate() (pyrenew.process.simplerandomwalk.simplerandomwalkprocess static method)": [[4, "pyrenew.process.simplerandomwalk.SimpleRandomWalkProcess.validate"]]}})
diff --git a/docs/source/msei_reference/model.rst b/docs/source/msei_reference/model.rst
index d430154c..21109cc4 100644
--- a/docs/source/msei_reference/model.rst
+++ b/docs/source/msei_reference/model.rst
@@ -1,10 +1,10 @@
MSEI Model
==========
-Hospitalizations
-----------------
+Hospital Admissions
+-------------------
-.. automodule:: pyrenew.model.hospitalizations
+.. automodule:: pyrenew.model.admissionsmodel
:members:
:undoc-members:
:show-inheritance:
@@ -12,7 +12,7 @@ Hospitalizations
Reproduction Number Renewal Infections
--------------------------------------
-.. automodule:: pyrenew.model.rtinfectionsrenewal
+.. automodule:: pyrenew.model.rtinfectionsrenewalmodel
:members:
:undoc-members:
:show-inheritance:
diff --git a/model/README.md b/model/README.md
index 8c873ad6..d1f1e698 100755
--- a/model/README.md
+++ b/model/README.md
@@ -12,4 +12,4 @@ pip install git+https://github.com/cdcent/cfa-pyrenew.git
## Demo
-The [`docs`](docs) folder contains quarto documents to get you started. It simulates observed hospitalizations using a simple renewal process model and then fits it using a No-U-Turn Sampler.
+The [`docs`](docs) folder contains quarto documents to get you started. It simulates observed hospital admissions using a simple renewal process model and then fits it using a No-U-Turn Sampler.
diff --git a/model/docs/example-with-datasets.md b/model/docs/example-with-datasets.md
index c8c5887d..2701f635 100644
--- a/model/docs/example-with-datasets.md
+++ b/model/docs/example-with-datasets.md
@@ -26,7 +26,7 @@ use a negative binomial distribution:
$$
\begin{align*}
-h(t) & \sim \text{NegativeNinomial}\left(\text{concentration} = 1, \text{mean} = H(t)\right) \\
+h(t) & \sim \text{NegativeBinomial}\left(\text{concentration} = 1, \text{mean} = H(t)\right) \\
H(t) & = \omega(t) p_\mathrm{hosp}(t) \sum_{\tau = 0}^{T_d} d(\tau) I(t-\tau)
\end{align*}
$$
@@ -232,9 +232,9 @@ Notice all the components are `RandomVariable` instances. We can now
build the model:
``` python
-hosp_model = model.HospitalizationsModel(
+hosp_model = model.HospitalAdmissionsModel(
latent_infections=latent_inf,
- latent_hospitalizations=latent_hosp,
+ latent_admissions=latent_hosp,
I0=I0,
gen_int=gen_int,
Rt_process=rtproc,
@@ -282,7 +282,7 @@ Infections](example-with-datasets_files/figure-commonmark/basic-fig-output-1.png
We can fit the model to the data. We will use the `run` method of the
model object. The two inputs this model requires are `n_timepoints` and
-`observed_hospitalizations`
+`observed_admissions`
``` python
import jax
@@ -291,7 +291,7 @@ hosp_model.run(
num_samples=2000,
num_warmup=2000,
n_timepoints=dat.shape[0] - 1,
- observed_hospitalizations=dat["daily_hosp_admits"].to_numpy(),
+ observed_admissions=dat["daily_hosp_admits"].to_numpy(),
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
)
@@ -301,7 +301,7 @@ We can use the `plot_posterior` method to visualize the results[^1]:
``` python
out = hosp_model.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
obs_signal=dat["daily_hosp_admits"].to_numpy(),
)
@@ -317,29 +317,29 @@ this.
## Padding the model
-We can use the padding argument to solve the overestimation of
-hospitalizations in the first half of the model. By setting
-`padding > 0`, the model then assumes that the first `padding`
-observations are missing; thus, only observations after `padding` will
-count towards the likelihood of the model. In practice, the model will
-extend the estimated Rt and latent infections by `padding` days, given
-time to adjust to the observed data. The following code will add 21 days
-of missing data at the beginning of the model and re-estimate it with
+We can use the padding argument to solve the overestimation of hospital
+admissions in the first half of the model. By setting `padding > 0`, the
+model then assumes that the first `padding` observations are missing;
+thus, only observations after `padding` will count towards the
+likelihood of the model. In practice, the model will extend the
+estimated Rt and latent infections by `padding` days, given time to
+adjust to the observed data. The following code will add 21 days of
+missing data at the beginning of the model and re-estimate it with
`padding = 21`:
``` python
days_to_impute = 21
-dat2 = dat["daily_hosp_admits"].to_numpy()
+dat_w_padding = dat["daily_hosp_admits"].to_numpy()
-# Add 21 Nas to the beginning of dat2
-dat2 = np.hstack((np.repeat(np.nan, days_to_impute), dat2))
+# Add 21 Nas to the beginning of dat_w_padding
+dat_w_padding = np.hstack((np.repeat(np.nan, days_to_impute), dat_w_padding))
hosp_model.run(
num_samples=2000,
num_warmup=2000,
- n_timepoints=dat2.shape[0] - 1,
- observed_hospitalizations=dat2,
+ n_timepoints=dat_w_padding.shape[0] - 1,
+ observed_admissions=dat_w_padding,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
padding=days_to_impute, # Padding the model
@@ -350,9 +350,9 @@ And plotting the results:
``` python
out = hosp_model.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
- obs_signal=dat2,
+ obs_signal=dat_w_padding,
)
```
@@ -431,9 +431,9 @@ latent_hosp_wday_effect = latent.HospitalAdmissions(
weekday_effect_dist=weekday_effect,
)
-hosp_model_weekday = model.HospitalizationsModel(
+hosp_model_weekday = model.HospitalAdmissionsModel(
latent_infections=latent_inf,
- latent_hospitalizations=latent_hosp_wday_effect,
+ latent_admissions=latent_hosp_wday_effect,
I0=I0,
gen_int=gen_int,
Rt_process=rtproc,
@@ -447,8 +447,8 @@ Running the model (with the same padding as before):
hosp_model_weekday.run(
num_samples=2000,
num_warmup=2000,
- n_timepoints=dat2.shape[0] - 1,
- observed_hospitalizations=dat2,
+ n_timepoints=dat_w_padding.shape[0] - 1,
+ observed_admissions=dat_w_padding,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
padding=days_to_impute,
@@ -459,9 +459,9 @@ And plotting the results:
``` python
out = hosp_model_weekday.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
- obs_signal=dat2,
+ obs_signal=dat_w_padding,
)
```
diff --git a/model/docs/example-with-datasets.qmd b/model/docs/example-with-datasets.qmd
index 6c58a08c..470614d3 100644
--- a/model/docs/example-with-datasets.qmd
+++ b/model/docs/example-with-datasets.qmd
@@ -18,7 +18,7 @@ Where $h(t)$ is the observed number of hospital admissions at time $t$, and $H(t
$$
\begin{align*}
-h(t) & \sim \text{NegativeNinomial}\left(\text{concentration} = 1, \text{mean} = H(t)\right) \\
+h(t) & \sim \text{NegativeBinomial}\left(\text{concentration} = 1, \text{mean} = H(t)\right) \\
H(t) & = \omega(t) p_\mathrm{hosp}(t) \sum_{\tau = 0}^{T_d} d(\tau) I(t-\tau)
\end{align*}
$$
@@ -159,9 +159,9 @@ Notice all the components are `RandomVariable` instances. We can now build the m
```{python}
#| label: init-model
-hosp_model = model.HospitalizationsModel(
+hosp_model = model.HospitalAdmissionsModel(
latent_infections=latent_inf,
- latent_hospitalizations=latent_hosp,
+ latent_admissions=latent_hosp,
I0=I0,
gen_int=gen_int,
Rt_process=rtproc,
@@ -208,7 +208,7 @@ plt.show()
## Fitting the model
-We can fit the model to the data. We will use the `run` method of the model object. The two inputs this model requires are `n_timepoints` and `observed_hospitalizations`
+We can fit the model to the data. We will use the `run` method of the model object. The two inputs this model requires are `n_timepoints` and `observed_admissions`
```{python}
@@ -219,7 +219,7 @@ hosp_model.run(
num_samples=2000,
num_warmup=2000,
n_timepoints=dat.shape[0] - 1,
- observed_hospitalizations=dat["daily_hosp_admits"].to_numpy(),
+ observed_admissions=dat["daily_hosp_admits"].to_numpy(),
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
)
@@ -234,7 +234,7 @@ We can use the `plot_posterior` method to visualize the results[^capture]:
#| fig-cap: Hospital Admissions posterior distribution
#| fig-cap-location: bottom
out = hosp_model.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
obs_signal=dat["daily_hosp_admits"].to_numpy(),
)
@@ -244,22 +244,22 @@ The first half of the model is not looking good. The reason is that the infectio
## Padding the model
-We can use the padding argument to solve the overestimation of hospitalizations in the first half of the model. By setting `padding > 0`, the model then assumes that the first `padding` observations are missing; thus, only observations after `padding` will count towards the likelihood of the model. In practice, the model will extend the estimated Rt and latent infections by `padding` days, given time to adjust to the observed data. The following code will add 21 days of missing data at the beginning of the model and re-estimate it with `padding = 21`:
+We can use the padding argument to solve the overestimation of hospital admissions in the first half of the model. By setting `padding > 0`, the model then assumes that the first `padding` observations are missing; thus, only observations after `padding` will count towards the likelihood of the model. In practice, the model will extend the estimated Rt and latent infections by `padding` days, given time to adjust to the observed data. The following code will add 21 days of missing data at the beginning of the model and re-estimate it with `padding = 21`:
```{python}
#| label: model-fit-padding
days_to_impute = 21
-dat2 = dat["daily_hosp_admits"].to_numpy()
+dat_w_padding = dat["daily_hosp_admits"].to_numpy()
-# Add 21 Nas to the beginning of dat2
-dat2 = np.hstack((np.repeat(np.nan, days_to_impute), dat2))
+# Add 21 Nas to the beginning of dat_w_padding
+dat_w_padding = np.hstack((np.repeat(np.nan, days_to_impute), dat_w_padding))
hosp_model.run(
num_samples=2000,
num_warmup=2000,
- n_timepoints=dat2.shape[0] - 1,
- observed_hospitalizations=dat2,
+ n_timepoints=dat_w_padding.shape[0] - 1,
+ observed_admissions=dat_w_padding,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
padding=days_to_impute, # Padding the model
@@ -273,9 +273,9 @@ And plotting the results:
#| fig-cap: Hospital Admissions posterior distribution
#| fig-cap-location: bottom
out = hosp_model.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
- obs_signal=dat2,
+ obs_signal=dat_w_padding,
)
```
@@ -341,9 +341,9 @@ latent_hosp_wday_effect = latent.HospitalAdmissions(
weekday_effect_dist=weekday_effect,
)
-hosp_model_weekday = model.HospitalizationsModel(
+hosp_model_weekday = model.HospitalAdmissionsModel(
latent_infections=latent_inf,
- latent_hospitalizations=latent_hosp_wday_effect,
+ latent_admissions=latent_hosp_wday_effect,
I0=I0,
gen_int=gen_int,
Rt_process=rtproc,
@@ -358,8 +358,8 @@ Running the model (with the same padding as before):
hosp_model_weekday.run(
num_samples=2000,
num_warmup=2000,
- n_timepoints=dat2.shape[0] - 1,
- observed_hospitalizations=dat2,
+ n_timepoints=dat_w_padding.shape[0] - 1,
+ observed_admissions=dat_w_padding,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
padding=days_to_impute,
@@ -374,8 +374,8 @@ And plotting the results:
#| fig-cap-location: bottom
#|
out = hosp_model_weekday.plot_posterior(
- var="predicted_hospitalizations",
+ var="predicted_admissions",
ylab="Hospital Admissions",
- obs_signal=dat2,
+ obs_signal=dat_w_padding,
)
```
diff --git a/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-padding-and-weekday-output-1.png b/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-padding-and-weekday-output-1.png
index ec802f11..1977d891 100644
Binary files a/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-padding-and-weekday-output-1.png and b/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-padding-and-weekday-output-1.png differ
diff --git a/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-with-padding-output-1.png b/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-with-padding-output-1.png
index 4110babc..8f03dceb 100644
Binary files a/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-with-padding-output-1.png and b/model/docs/example-with-datasets_files/figure-commonmark/output-admissions-with-padding-output-1.png differ
diff --git a/model/docs/example-with-datasets_files/figure-commonmark/output-hospital-admissions-output-1.png b/model/docs/example-with-datasets_files/figure-commonmark/output-hospital-admissions-output-1.png
index ef75b545..8754e992 100644
Binary files a/model/docs/example-with-datasets_files/figure-commonmark/output-hospital-admissions-output-1.png and b/model/docs/example-with-datasets_files/figure-commonmark/output-hospital-admissions-output-1.png differ
diff --git a/model/docs/example-with-datasets_files/figure-commonmark/output-infections-with-padding-output-1.png b/model/docs/example-with-datasets_files/figure-commonmark/output-infections-with-padding-output-1.png
index 8d368b8c..8fc09215 100644
Binary files a/model/docs/example-with-datasets_files/figure-commonmark/output-infections-with-padding-output-1.png and b/model/docs/example-with-datasets_files/figure-commonmark/output-infections-with-padding-output-1.png differ
diff --git a/model/docs/getting-started_files/figure-commonmark/output-rt-output-1.png b/model/docs/getting-started_files/figure-commonmark/output-rt-output-1.png
index db5c039e..ecc6661d 100644
Binary files a/model/docs/getting-started_files/figure-commonmark/output-rt-output-1.png and b/model/docs/getting-started_files/figure-commonmark/output-rt-output-1.png differ
diff --git a/model/docs/pyrenew_demo.md b/model/docs/pyrenew_demo.md
index df410127..0e9d6cf9 100644
--- a/model/docs/pyrenew_demo.md
+++ b/model/docs/pyrenew_demo.md
@@ -83,7 +83,7 @@ process:
``` python
from pyrenew.observation import PoissonObservation
from pyrenew.deterministic import DeterministicPMF, DeterministicVariable
-from pyrenew.model import HospitalizationsModel
+from pyrenew.model import HospitalAdmissionsModel
from pyrenew.process import RtRandomWalkProcess
```
@@ -133,31 +133,31 @@ inf_hosp_int = DeterministicPMF(
jnp.array([0, 0, 0,0,0,0,0,0,0,0,0,0,0, 0.25, 0.5, 0.1, 0.1, 0.05]),
)
-latent_hospitalizations = HospitalAdmissions(
+latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp_int,
infect_hosp_rate_dist = InfectHospRate(
dist=dist.LogNormal(jnp.log(0.05), 0.05),
),
)
-# 5) An observation process for the hospitalizations
-obs_process = PoissonObservation()
+# 5) An observation process for the hospital admissions
+admissions_process = PoissonObservation()
# 6) A random walk process (it could be deterministic using
# pyrenew.process.DeterministicProcess())
Rt_process = RtRandomWalkProcess()
```
-The `HospitalizationsModel` is then initialized using the initial
+The `HospitalAdmissionsModel` is then initialized using the initial
conditions just defined:
``` python
# Initializing the model
-hospmodel = HospitalizationsModel(
+hospmodel = HospitalAdmissionsModel(
gen_int=gen_int,
I0=I0,
- latent_hospitalizations=latent_hospitalizations,
- observation_process=obs_process,
+ latent_admissions=latent_admissions,
+ observation_process=admissions_process,
latent_infections=latent_infections,
Rt_process=Rt_process
)
@@ -189,7 +189,7 @@ x
0.01345188], sampled_admissions=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0])
Visualizations of the single model output show (top) infections over the
-30 time steps, (middle) hospitalizations over the 30 time steps, and
+30 time steps, (middle) hospital admissions over the 30 time steps, and
(bottom)
``` python
@@ -216,7 +216,7 @@ distribution of the model parameters. The model is run for
hospmodel.run(
num_warmup=1000,
num_samples=1000,
- observed_hospitalizations=x.sampled_admissions,
+ observed_admissions=x.sampled_admissions,
n_timepoints = len(x.sampled_admissions)-1,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
@@ -231,39 +231,39 @@ hospmodel.print_summary()
mean std median 5.0% 95.0% n_eff r_hat
- I0 1.27 1.10 0.97 0.10 2.42 1132.34 1.00
- IHR 0.05 0.00 0.05 0.05 0.05 2306.45 1.00
- Rt0 1.23 0.17 1.23 0.93 1.48 1327.22 1.00
- Rt_transformed_rw_diffs[0] -0.00 0.02 -0.00 -0.04 0.04 1404.95 1.00
- Rt_transformed_rw_diffs[1] 0.00 0.03 0.00 -0.04 0.04 2280.86 1.00
- Rt_transformed_rw_diffs[2] -0.00 0.02 -0.00 -0.04 0.04 2119.83 1.00
- Rt_transformed_rw_diffs[3] 0.00 0.02 -0.00 -0.04 0.04 2196.86 1.00
- Rt_transformed_rw_diffs[4] 0.00 0.02 -0.00 -0.03 0.04 2391.45 1.00
- Rt_transformed_rw_diffs[5] 0.00 0.03 0.00 -0.04 0.04 2043.02 1.00
- Rt_transformed_rw_diffs[6] 0.00 0.02 0.00 -0.04 0.04 1514.40 1.00
- Rt_transformed_rw_diffs[7] -0.00 0.02 -0.00 -0.04 0.04 2619.69 1.00
- Rt_transformed_rw_diffs[8] 0.00 0.03 0.00 -0.04 0.04 1883.84 1.00
- Rt_transformed_rw_diffs[9] 0.00 0.03 0.00 -0.04 0.04 2015.66 1.00
- Rt_transformed_rw_diffs[10] 0.00 0.02 0.00 -0.04 0.04 2045.47 1.00
- Rt_transformed_rw_diffs[11] -0.00 0.03 0.00 -0.04 0.04 1615.10 1.00
- Rt_transformed_rw_diffs[12] 0.00 0.02 0.00 -0.04 0.04 2206.32 1.00
- Rt_transformed_rw_diffs[13] 0.00 0.03 0.00 -0.04 0.04 1175.93 1.00
- Rt_transformed_rw_diffs[14] -0.00 0.03 -0.00 -0.04 0.04 1606.26 1.00
- Rt_transformed_rw_diffs[15] -0.00 0.03 -0.00 -0.04 0.04 2344.62 1.00
- Rt_transformed_rw_diffs[16] -0.00 0.02 0.00 -0.04 0.04 1522.33 1.00
- Rt_transformed_rw_diffs[17] 0.00 0.03 0.00 -0.04 0.04 2157.17 1.00
- Rt_transformed_rw_diffs[18] -0.00 0.02 -0.00 -0.04 0.04 1594.95 1.00
- Rt_transformed_rw_diffs[19] 0.00 0.03 -0.00 -0.04 0.04 1698.70 1.00
- Rt_transformed_rw_diffs[20] 0.00 0.02 0.00 -0.04 0.04 1726.18 1.00
- Rt_transformed_rw_diffs[21] 0.00 0.02 -0.00 -0.04 0.04 2386.35 1.00
- Rt_transformed_rw_diffs[22] 0.00 0.03 0.00 -0.04 0.04 2028.63 1.00
- Rt_transformed_rw_diffs[23] 0.00 0.02 0.00 -0.04 0.03 1669.71 1.00
- Rt_transformed_rw_diffs[24] 0.00 0.02 0.00 -0.04 0.04 2126.33 1.00
- Rt_transformed_rw_diffs[25] -0.00 0.02 -0.00 -0.04 0.04 2119.74 1.00
- Rt_transformed_rw_diffs[26] 0.00 0.03 0.00 -0.04 0.04 2657.91 1.00
- Rt_transformed_rw_diffs[27] -0.00 0.03 0.00 -0.04 0.04 1939.30 1.00
- Rt_transformed_rw_diffs[28] -0.00 0.02 -0.00 -0.04 0.04 1737.84 1.00
- Rt_transformed_rw_diffs[29] -0.00 0.03 -0.00 -0.04 0.04 2105.55 1.00
+ I0 1.30 1.20 0.94 0.07 2.75 975.77 1.00
+ Rt0 1.24 0.17 1.23 0.96 1.50 1734.73 1.00
+ Rt_transformed_rw_diffs[0] -0.00 0.03 0.00 -0.04 0.04 2293.16 1.00
+ Rt_transformed_rw_diffs[1] 0.00 0.03 -0.00 -0.04 0.04 1610.92 1.00
+ Rt_transformed_rw_diffs[2] 0.00 0.03 -0.00 -0.04 0.04 1998.77 1.00
+ Rt_transformed_rw_diffs[3] 0.00 0.02 -0.00 -0.04 0.04 1882.49 1.00
+ Rt_transformed_rw_diffs[4] 0.00 0.02 0.00 -0.04 0.04 1734.76 1.00
+ Rt_transformed_rw_diffs[5] 0.00 0.02 -0.00 -0.04 0.04 2342.58 1.00
+ Rt_transformed_rw_diffs[6] 0.00 0.03 0.00 -0.04 0.04 1865.46 1.00
+ Rt_transformed_rw_diffs[7] 0.00 0.02 0.00 -0.04 0.04 1803.14 1.00
+ Rt_transformed_rw_diffs[8] -0.00 0.02 -0.00 -0.04 0.04 3352.33 1.00
+ Rt_transformed_rw_diffs[9] -0.00 0.03 -0.00 -0.04 0.04 2182.47 1.00
+ Rt_transformed_rw_diffs[10] 0.00 0.03 0.00 -0.04 0.04 1589.55 1.00
+ Rt_transformed_rw_diffs[11] -0.00 0.02 -0.00 -0.04 0.04 2951.80 1.00
+ Rt_transformed_rw_diffs[12] -0.00 0.03 0.00 -0.04 0.04 1706.74 1.00
+ Rt_transformed_rw_diffs[13] 0.00 0.02 0.00 -0.04 0.04 1937.62 1.00
+ Rt_transformed_rw_diffs[14] 0.00 0.03 -0.00 -0.04 0.04 1162.86 1.00
+ Rt_transformed_rw_diffs[15] -0.00 0.03 -0.00 -0.04 0.04 1827.85 1.00
+ Rt_transformed_rw_diffs[16] -0.00 0.03 -0.00 -0.04 0.04 2005.09 1.00
+ Rt_transformed_rw_diffs[17] -0.00 0.02 -0.00 -0.03 0.04 1311.79 1.00
+ Rt_transformed_rw_diffs[18] 0.00 0.03 -0.00 -0.04 0.04 1805.85 1.00
+ Rt_transformed_rw_diffs[19] 0.00 0.03 -0.00 -0.04 0.04 1557.23 1.00
+ Rt_transformed_rw_diffs[20] -0.00 0.03 -0.00 -0.04 0.05 2047.52 1.00
+ Rt_transformed_rw_diffs[21] 0.00 0.02 0.00 -0.04 0.04 1598.30 1.00
+ Rt_transformed_rw_diffs[22] 0.00 0.02 0.00 -0.04 0.04 2065.97 1.00
+ Rt_transformed_rw_diffs[23] 0.00 0.03 -0.00 -0.04 0.05 2000.96 1.00
+ Rt_transformed_rw_diffs[24] 0.00 0.02 0.00 -0.04 0.04 2301.05 1.00
+ Rt_transformed_rw_diffs[25] 0.00 0.03 0.00 -0.04 0.04 1958.36 1.00
+ Rt_transformed_rw_diffs[26] -0.00 0.02 -0.00 -0.04 0.03 1554.19 1.00
+ Rt_transformed_rw_diffs[27] 0.00 0.03 0.00 -0.04 0.04 2474.99 1.00
+ Rt_transformed_rw_diffs[28] -0.00 0.03 0.00 -0.04 0.05 1944.24 1.00
+ Rt_transformed_rw_diffs[29] -0.00 0.02 -0.00 -0.04 0.04 1820.05 1.00
+ infection_hosp_rate 0.05 0.00 0.05 0.05 0.05 2296.48 1.00
Number of divergences: 0
diff --git a/model/docs/pyrenew_demo.qmd b/model/docs/pyrenew_demo.qmd
index e987df95..418218d2 100644
--- a/model/docs/pyrenew_demo.qmd
+++ b/model/docs/pyrenew_demo.qmd
@@ -64,7 +64,7 @@ Additionally, import several classes from Pyrenew, including a Poisson observati
```{python}
from pyrenew.observation import PoissonObservation
from pyrenew.deterministic import DeterministicPMF, DeterministicVariable
-from pyrenew.model import HospitalizationsModel
+from pyrenew.model import HospitalAdmissionsModel
from pyrenew.process import RtRandomWalkProcess
```
@@ -101,30 +101,30 @@ inf_hosp_int = DeterministicPMF(
jnp.array([0, 0, 0,0,0,0,0,0,0,0,0,0,0, 0.25, 0.5, 0.1, 0.1, 0.05]),
)
-latent_hospitalizations = HospitalAdmissions(
+latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp_int,
infect_hosp_rate_dist = InfectHospRate(
dist=dist.LogNormal(jnp.log(0.05), 0.05),
),
)
-# 5) An observation process for the hospitalizations
-obs_process = PoissonObservation()
+# 5) An observation process for the hospital admissions
+admissions_process = PoissonObservation()
# 6) A random walk process (it could be deterministic using
# pyrenew.process.DeterministicProcess())
Rt_process = RtRandomWalkProcess()
```
-The `HospitalizationsModel` is then initialized using the initial conditions just defined:
+The `HospitalAdmissionsModel` is then initialized using the initial conditions just defined:
```{python}
# Initializing the model
-hospmodel = HospitalizationsModel(
+hospmodel = HospitalAdmissionsModel(
gen_int=gen_int,
I0=I0,
- latent_hospitalizations=latent_hospitalizations,
- observation_process=obs_process,
+ latent_admissions=latent_admissions,
+ observation_process=admissions_process,
latent_infections=latent_infections,
Rt_process=Rt_process
)
@@ -138,7 +138,7 @@ with seed(rng_seed=np.random.randint(1, 60)):
x
```
-Visualizations of the single model output show (top) infections over the 30 time steps, (middle) hospitalizations over the 30 time steps, and (bottom)
+Visualizations of the single model output show (top) infections over the 30 time steps, (middle) hospital admissions over the 30 time steps, and (bottom)
```{python}
#| label: fig-hosp
@@ -159,7 +159,7 @@ To fit the `hospmodel` to the simulated data, we call `hospmodel.run()`, an MCMC
hospmodel.run(
num_warmup=1000,
num_samples=1000,
- observed_hospitalizations=x.sampled_admissions,
+ observed_admissions=x.sampled_admissions,
n_timepoints = len(x.sampled_admissions)-1,
rng_key=jax.random.PRNGKey(54),
mcmc_args=dict(progress_bar=False),
diff --git a/model/docs/pyrenew_demo_files/figure-commonmark/fig-sampled-rt-output-1.png b/model/docs/pyrenew_demo_files/figure-commonmark/fig-sampled-rt-output-1.png
index eea16418..f0a0816a 100644
Binary files a/model/docs/pyrenew_demo_files/figure-commonmark/fig-sampled-rt-output-1.png and b/model/docs/pyrenew_demo_files/figure-commonmark/fig-sampled-rt-output-1.png differ
diff --git a/model/equations.md b/model/equations.md
index 21f15920..cab860f0 100755
--- a/model/equations.md
+++ b/model/equations.md
@@ -13,7 +13,7 @@ Eventually, it should incorporate information about the software implementation
- [Left truncation for the generation interval](#left-truncation-for-the-generation-interval)
- [Reporting delay between the time of reference and the time of report](#reporting-delay-between-the-time-of-reference-and-the-time-of-report)
- [Signals](#signals)
- - [Hospitalizations](#hospitalizations)
+ - [Hospital Admissions](#hospital-admissions)
- [Wastewater](#wastewater)
- [Overview](#overview)
@@ -147,9 +147,9 @@ $$h_{t,d} = P(\text{delay}=d|\text{delay} \geq d, W_{t,d}).$$
## Signals
-### Hospitalizations
+### Hospital Admissions
-In the wastewater model[^ww], the observed hospitalizations $h_t$ are the realization of a count random variable with mean modeled as a function of a renewal process, $H(t)$. Following the wastewater model's notation, the two equations that characterized this model component are:
+In the wastewater model[^ww], the observed hospital admissions $h_t$ are the realization of a count random variable with mean modeled as a function of a renewal process, $H(t)$. Following the wastewater model's notation, the two equations that characterized this model component are:
[^ww]: https://github.com/cdcent/cfa-forecast-renewal-ww/blob/main/model_definition.md#hospital-admissions-component
@@ -205,7 +205,7 @@ flowchart LR
subgraph signals["Signals in location j"]
direction TB
signals_elements["y1: Cases
- y2: Hospitalizations
+ y2: Hospital Admissions
y3: Wastewater
...
yM: M-th signal"]
diff --git a/model/src/pyrenew/latent/hospitaladmissions.py b/model/src/pyrenew/latent/hospitaladmissions.py
index ccb6543f..91d0fa81 100644
--- a/model/src/pyrenew/latent/hospitaladmissions.py
+++ b/model/src/pyrenew/latent/hospitaladmissions.py
@@ -13,23 +13,22 @@
class HospAdmissionsSample(NamedTuple):
"""
- A container for holding the output from HospAdmissionsSample.sample.
+ A container for holding the output from HospAdmissionsSample.sample.
+ >>>>>>> origin/main
- Parameters
- ----------
- IHR : float, optional
- The infected hospitalization rate. Defaults to None.
- predicted : ArrayLike or None
- The predicted number of hospital admissions. Defaults to None.
+ Parameters
+ ----------
+ infection_hosp_rate : float, optional
+ The infection-to-hospitalization rate. Defaults to None.
+ predicted : ArrayLike or None
+ The predicted number of hospital admissions. Defaults to None.
"""
- IHR: float | None = None
+ infection_hosp_rate: float | None = None
predicted: ArrayLike | None = None
def __repr__(self):
- return (
- f"HospAdmissionsSample(IHR={self.IRH}, predicted={self.predicted})"
- )
+ return f"HospAdmissionsSample(infection_hosp_rate={self.IRH}, predicted={self.predicted})"
class InfectHospRateSample(NamedTuple):
@@ -50,13 +49,21 @@ def __repr__(self):
class InfectHospRate(RandomVariable):
"""
- Infection to Hospitalization Rate
+ Infection-to-Hospitalization rate
+
+ Methods
+ -------
+ validate(distr)
+ Validates distribution is Numpyro distribution
+ sample(**kwargs)
+ Produces a sample of the infection-hospitalization rate (IHR).
+ =======
"""
def __init__(
self,
dist: dist.Distribution | None,
- varname: Optional[str] = "IHR",
+ varname: Optional[str] = "infection_hosp_rate",
) -> None:
"""
Default constructor
@@ -66,7 +73,7 @@ def __init__(
dist : dist.Distribution
Prior distribution of the IHR.
varname : str, optional
- Name of the random variable in the model, by default "IHR."
+ Name of the random variable in the model, by default "infection_hosp_rate."
Returns
-------
@@ -98,7 +105,7 @@ def validate(distr: dist.Distribution) -> None:
def sample(self, **kwargs) -> InfectHospRateSample:
"""
- Produces a sample of the IHR
+ Produces a sample of an infection-to-hospitalization Rate (IHR)
Parameters
----------
@@ -122,7 +129,7 @@ def sample(self, **kwargs) -> InfectHospRateSample:
class HospitalAdmissions(RandomVariable):
r"""Latent hospital admissions
- Implements a renewal process for the expected number of hospitalizations.
+ Implements a renewal process for the expected number of hospital admissions.
Notes
@@ -153,7 +160,7 @@ def __init__(
self,
infection_to_admission_interval: RandomVariable,
infect_hosp_rate_dist: RandomVariable,
- hospitalizations_predicted_varname: str = "predicted_hospitalizations",
+ admissions_predicted_varname: str = "predicted_admissions",
weekday_effect_dist: Optional[RandomVariable] = None,
hosp_report_prob_dist: Optional[RandomVariable] = None,
) -> None:
@@ -162,13 +169,13 @@ def __init__(
Parameters
----------
infection_to_admission_interval : RandomVariable
- pmf for reporting (informing) hospitalizations (see
+ pmf for reporting (informing) hospital admissions (see
pyrenew.observations.Deterministic).
infect_hosp_rate_dist : RandomVariable
Infection to hospitalization rate distribution.
- hospitalizations_predicted_varname : str
+ admissions_predicted_varname : str
Name to assign to the deterministic component in numpyro of
- predicted hospitalizations.
+ predicted hospital admissions.
weekday_effect_dist : RandomVariable, optional
Weekday effect.
hosp_report_prob_dist : RandomVariable, optional
@@ -191,9 +198,7 @@ def __init__(
hosp_report_prob_dist,
)
- self.hospitalizations_predicted_varname = (
- hospitalizations_predicted_varname
- )
+ self.admissions_predicted_varname = admissions_predicted_varname
self.infect_hosp_rate_dist = infect_hosp_rate_dist
self.weekday_effect_dist = weekday_effect_dist
@@ -256,33 +261,32 @@ def sample(
HospAdmissionsSample
"""
- IHR, *_ = self.infect_hosp_rate_dist.sample(**kwargs)
+ infection_hosp_rate, *_ = self.infect_hosp_rate_dist.sample(**kwargs)
- IHR_t = IHR * latent
+ infection_hosp_rate_t = infection_hosp_rate * latent
(
infection_to_admission_interval,
*_,
) = self.infection_to_admission_interval.sample(**kwargs)
- predicted_hospitalizations = jnp.convolve(
- IHR_t, infection_to_admission_interval, mode="full"
- )[: IHR_t.shape[0]]
+ predicted_admissions = jnp.convolve(
+ infection_hosp_rate_t, infection_to_admission_interval, mode="full"
+ )[: infection_hosp_rate_t.shape[0]]
# Applying weekday effect
- predicted_hospitalizations = (
- predicted_hospitalizations
- * self.weekday_effect_dist.sample(**kwargs)[0]
+ predicted_admissions = (
+ predicted_admissions * self.weekday_effect_dist.sample(**kwargs)[0]
)
# Applying probability of hospitalization effect
- predicted_hospitalizations = (
- predicted_hospitalizations
+ predicted_admissions = (
+ predicted_admissions
* self.hosp_report_prob_dist.sample(**kwargs)[0]
)
npro.deterministic(
- self.hospitalizations_predicted_varname, predicted_hospitalizations
+ self.admissions_predicted_varname, predicted_admissions
)
- return HospAdmissionsSample(IHR, predicted_hospitalizations)
+ return HospAdmissionsSample(infection_hosp_rate, predicted_admissions)
diff --git a/model/src/pyrenew/model/__init__.py b/model/src/pyrenew/model/__init__.py
index 5f27f728..a0cb40b9 100644
--- a/model/src/pyrenew/model/__init__.py
+++ b/model/src/pyrenew/model/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from pyrenew.model.hospitalizations import HospitalizationsModel
-from pyrenew.model.rtinfectionsrenewal import RtInfectionsRenewalModel
+from pyrenew.model.admissionsmodel import HospitalAdmissionsModel
+from pyrenew.model.rtinfectionsrenewalmodel import RtInfectionsRenewalModel
-__all__ = ["RtInfectionsRenewalModel", "HospitalizationsModel"]
+__all__ = ["RtInfectionsRenewalModel", "HospitalAdmissionsModel"]
diff --git a/model/src/pyrenew/model/hospitalizations.py b/model/src/pyrenew/model/admissionsmodel.py
similarity index 53%
rename from model/src/pyrenew/model/hospitalizations.py
rename to model/src/pyrenew/model/admissionsmodel.py
index 9509189f..8b560845 100644
--- a/model/src/pyrenew/model/hospitalizations.py
+++ b/model/src/pyrenew/model/admissionsmodel.py
@@ -6,7 +6,7 @@
import jax.numpy as jnp
from numpy.typing import ArrayLike
from pyrenew.metaclass import Model, RandomVariable, _assert_sample_and_rtype
-from pyrenew.model.rtinfectionsrenewal import RtInfectionsRenewalModel
+from pyrenew.model.rtinfectionsrenewalmodel import RtInfectionsRenewalModel
class HospModelSample(NamedTuple):
@@ -37,9 +37,9 @@ def __repr__(self):
return f"HospModelSample(Rt={self.Rt}, latent_infections={self.latent_infections}, IHR={self.IHR}, latent_admissions={self.latent_admissions}, sampled_admissions={self.sampled_admissions})"
-class HospitalizationsModel(Model):
+class HospitalAdmissionsModel(Model):
"""
- HospitalAdmissions Model (BasicRenewal + HospitalAdmissions)
+ Hospital Admissions Model (BasicRenewal + HospitalAdmissions)
This class inherits from pyrenew.models.Model. It extends the
basic renewal model by adding a hospital admissions module, e.g.,
@@ -48,7 +48,7 @@ class HospitalizationsModel(Model):
def __init__(
self,
- latent_hospitalizations: RandomVariable,
+ latent_admissions: RandomVariable,
latent_infections: RandomVariable,
gen_int: RandomVariable,
I0: RandomVariable,
@@ -60,18 +60,18 @@ def __init__(
Parameters
----------
- latent_hospitalizations : RandomVariable
- Latent process for the hospitalizations.
+ latent_admissions : RandomVariable
+ Latent process for the hospital admissions.
latent_infections : RandomVariable
The infections latent process (passed to RtInfectionsRenewalModel).
gen_int : RandomVariable
Generation time (passed to RtInfectionsRenewalModel)
- I0 : RandomVariable
+ HospitalAdmissionsModel
Initial infections (passed to RtInfectionsRenewalModel)
Rt_process : RandomVariable
Rt process (passed to RtInfectionsRenewalModel).
observation_process : RandomVariable, optional
- Observation process for the hospitalizations.
+ Observation process for the hospital admissions.
Returns
-------
@@ -85,24 +85,24 @@ def __init__(
Rt_process=Rt_process,
)
- HospitalizationsModel.validate(
- latent_hospitalizations, observation_process
+ HospitalAdmissionsModel.validate(
+ latent_admissions, observation_process
)
- self.latent_hospitalizations = latent_hospitalizations
+ self.latent_admissions = latent_admissions
self.observation_process = observation_process
@staticmethod
- def validate(latent_hospitalizations, observation_process) -> None:
+ def validate(latent_admissions, observation_process) -> None:
"""
- Verifies types and status (RV) of latent and observed hospitalizations
+ Verifies types and status (RV) of latent and observed hospital admissions
Parameters
----------
- latent_hospitalizations : ArrayLike
- The latent process for the hospitalizations.
+ latent_admissions : ArrayLike
+ The latent process for the hospital admissions.
observation_process : ArrayLike
- The observed hospitalizations.
+ The observed hospital admissions.
Returns
-------
@@ -112,59 +112,70 @@ def validate(latent_hospitalizations, observation_process) -> None:
--------
_assert_sample_and_rtype : Perform type-checking and verify RV
"""
- _assert_sample_and_rtype(latent_hospitalizations, skip_if_none=False)
+ _assert_sample_and_rtype(latent_admissions, skip_if_none=False)
_assert_sample_and_rtype(observation_process, skip_if_none=False)
return None
- def sample_hospitalizations_latent(
+ def sample_latent_admissions(
self,
infections: ArrayLike,
**kwargs,
) -> tuple:
- """Sample number of hospitalizations
-
- Parameters
- ----------
- infections : ArrayLike
- The predicted infections array.
- **kwargs : dict, optional
- Additional keyword arguments passed through to internal
- sample() calls, should there be any.
-
- Returns
- -------
- tuple
-
- See Also
- --------
- latent_hospitalizations.sample : For sampling latent hospitalizations
+ """
+ Sample number of hospital admissions
+
+ Parameters
+ ----------
+ infections : ArrayLike
+ The predicted infections array.
+ **kwargs : dict, optional
+ Additional keyword arguments passed through to internal
+ sample() calls, should there be any.
+
+ Returns
+ -------
+ tuple
+
+ See Also
+ --------
+ <<<<<<< HEAD:model/src/pyrenew/model/admissionsmodel.py
+ latent_admissions.sample : For sampling latent hospital admissions
+
+ Notes
+ -----
+ TODO: Include example(s) here.
+ TODO: Cover Returns in more detail.
+ =======
+ latent_hospitalizations.sample : For sampling latent hospitalizations
+ >>>>>>> origin/main:model/src/pyrenew/model/hospitalizations.py
"""
- return self.latent_hospitalizations.sample(
+ return self.latent_admissions.sample(
latent=infections,
**kwargs,
)
- def sample_hospitalizations_obs(
+ def sample_admissions_process(
self,
predicted: ArrayLike,
- observed_hospitalizations: ArrayLike,
+ observed_admissions: ArrayLike,
name: str | None = None,
**kwargs,
) -> tuple:
- """Sample number of hospitalizations
+ """
+ Sample number of hospital admissions
Parameters
----------
predicted : ArrayLike
- The predicted hospitalizations.
- observed_hospitalizations : ArrayLike
+ The predicted hospital admissions.
+ obs : ArrayLike
The observed hospitalization data (to fit).
name : str, optional
Name of the random variable. Defaults to None.
**kwargs : dict, optional
Additional keyword arguments passed through to internal
- sample_hospitalizations_obs calls, should there be any.
+ obs calls, should there be any.
Returns
-------
@@ -173,7 +184,7 @@ def sample_hospitalizations_obs(
return self.observation_process.sample(
predicted=predicted,
- obs=observed_hospitalizations,
+ obs=observed_admissions,
name=name,
**kwargs,
)
@@ -181,36 +192,45 @@ def sample_hospitalizations_obs(
def sample(
self,
n_timepoints: int,
- observed_hospitalizations: ArrayLike | None = None,
+ observed_admissions: ArrayLike | None = None,
padding: int = 0,
**kwargs,
) -> HospModelSample:
"""
- Sample from the HospitalAdmissions model
-
- Parameters
- ----------
- n_timepoints : int
- Number of timepoints to sample (passed to the basic renewal model).
- observed_hospitalizations : ArrayLike, optional
- The observed hospitalization data (passed to the basic renewal
- model). Defaults to None (simulation, rather than fit).
- padding : int, optional
- Number of padding timepoints to add to the beginning of the
- simulation. Defaults to 0.
- **kwargs : dict, optional
- Additional keyword arguments passed through to internal sample()
- calls, should there be any.
-
- Returns
- -------
- HospModelSample
-
- See Also
- --------
- basic_renewal.sample : For sampling the basic renewal model
- sample_hospitalizations_latent : To sample latent hospitalization process
- sample_hospitalizations_obs : For sampling observed hospitalizations
+ Sample from the HospitalAdmissions model
+
+ Parameters
+ ----------
+ n_timepoints : int
+ Number of timepoints to sample (passed to the basic renewal model).
+ observed_admissions : ArrayLike, optional
+ The observed hospitalization data (passed to the basic renewal
+ model). Defaults to None (simulation, rather than fit).
+ padding : int, optional
+ Number of padding timepoints to add to the beginning of the
+ simulation. Defaults to 0.
+ **kwargs : dict, optional
+ Additional keyword arguments passed through to internal sample()
+ calls, should there be any.
+
+ Returns
+ -------
+ HospModelSample
+
+ See Also
+ --------
+ basic_renewal.sample : For sampling the basic renewal model
+ <<<<<<< HEAD:model/src/pyrenew/model/admissionsmodel.py
+ sample_latent_admissions : To sample latent hospitalization process
+ sample_observed_admissions : For sampling observed hospital admissions
+
+ Notes
+ -----
+ TODO: Include example(s) here.
+ =======
+ sample_hospitalizations_latent : To sample latent hospitalization process
+ sample_hospitalizations_obs : For sampling observed hospitalizations
+ >>>>>>> origin/main:model/src/pyrenew/model/hospitalizations.py
"""
# Getting the initial quantities from the basic model
@@ -221,35 +241,33 @@ def sample(
**kwargs,
)
- # Sampling the latent hospitalizations
+ # Sampling the latent hospital admissions
(
- IHR,
+ infection_hosp_rate,
latent,
*_,
- ) = self.sample_hospitalizations_latent(
+ ) = self.sample_latent_admissions(
infections=basic_model.latent_infections,
**kwargs,
)
- # Sampling the hospitalizations
+ # Sampling the hospital admissions
if self.observation_process is not None:
- if (observed_hospitalizations is not None) and (padding > 0):
+ if (observed_admissions is not None) and (padding > 0):
sampled_na = jnp.repeat(jnp.nan, padding)
- sampled_observed, *_ = self.sample_hospitalizations_obs(
+ sampled_observed, *_ = self.sample_admissions_process(
predicted=latent[padding:],
- observed_hospitalizations=observed_hospitalizations[
- padding:
- ],
+ observed_admissions=observed_admissions[padding:],
**kwargs,
)
sampled = jnp.hstack([sampled_na, sampled_observed])
else:
- sampled, *_ = self.sample_hospitalizations_obs(
+ sampled, *_ = self.sample_admissions_process(
predicted=latent,
- observed_hospitalizations=observed_hospitalizations,
+ observed_admissions=observed_admissions,
**kwargs,
)
else:
@@ -258,7 +276,7 @@ def sample(
return HospModelSample(
Rt=basic_model.Rt,
latent_infections=basic_model.latent_infections,
- IHR=IHR,
+ IHR=infection_hosp_rate,
latent_admissions=latent,
sampled_admissions=sampled,
)
diff --git a/model/src/pyrenew/model/rtinfectionsrenewal.py b/model/src/pyrenew/model/rtinfectionsrenewalmodel.py
similarity index 97%
rename from model/src/pyrenew/model/rtinfectionsrenewal.py
rename to model/src/pyrenew/model/rtinfectionsrenewalmodel.py
index 8f89d6c9..43ad11eb 100644
--- a/model/src/pyrenew/model/rtinfectionsrenewal.py
+++ b/model/src/pyrenew/model/rtinfectionsrenewalmodel.py
@@ -207,14 +207,17 @@ def sample_infections_obs(
name: str | None = None,
**kwargs,
) -> tuple:
- """Sample number of hospitalizations
+ """
+ Sample observed infections according
+ to an observation process, if one has
+ been specified.
Parameters
----------
predicted : ArrayLike
The predicted infecteds.
- observed_hospitalizations : ArrayLike | None, optional
- The observed values of hospital admissions, if any, for inference. Defaults to None.
+ observed_infections : ArrayLike | None, optional
+ The observed infection values, if any, for inference. Defaults to None.
name : str | None, optional
Name of the random variable passed to the RandomVariable. Defaults to None.
**kwargs : dict, optional
diff --git a/model/src/test/test_latent_hospitalizations.py b/model/src/test/test_latent_admissions.py
similarity index 87%
rename from model/src/test/test_latent_hospitalizations.py
rename to model/src/test/test_latent_admissions.py
index 056ce1e9..c9bc9651 100644
--- a/model/src/test/test_latent_hospitalizations.py
+++ b/model/src/test/test_latent_admissions.py
@@ -10,13 +10,13 @@
from pyrenew.process import RtRandomWalkProcess
-def test_hospitalizations_sample():
+def test_admissions_sample():
"""
- Check that an InfectionObservation
- can be initialized and sampled from (deterministic)
+ Check that a HospitalAdmissions latent process
+ can be initialized and sampled from.
"""
- # Generating Rt and Infections to compute the hospitalizations
+ # Generating Rt and Infections to compute the hospital admissions
np.random.seed(223)
rt = RtRandomWalkProcess()
with npro.handlers.seed(rng_seed=np.random.randint(1, 600)):
@@ -30,7 +30,7 @@ def test_hospitalizations_sample():
with npro.handlers.seed(rng_seed=np.random.randint(1, 600)):
inf_sampled1 = inf1.sample(Rt=sim_rt, gen_int=gen_int, I0=i0)
- # Testing the hospitalizations
+ # Testing the hospital admissions
inf_hosp = DeterministicPMF(
jnp.array(
[
diff --git a/model/src/test/test_model_hospitalizations.py b/model/src/test/test_model_hospitalizations.py
index 34dba6ab..7c129f67 100644
--- a/model/src/test/test_model_hospitalizations.py
+++ b/model/src/test/test_model_hospitalizations.py
@@ -14,7 +14,7 @@
Infections0,
)
from pyrenew.metaclass import RandomVariable
-from pyrenew.model import HospitalizationsModel
+from pyrenew.model import HospitalAdmissionsModel
from pyrenew.observation import PoissonObservation
from pyrenew.process import RtRandomWalkProcess
@@ -72,20 +72,20 @@ def test_model_hosp_no_obs_model():
),
)
- latent_hospitalizations = HospitalAdmissions(
+ latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp,
- hospitalizations_predicted_varname="observed_hospitalizations",
+ admissions_predicted_varname="observed_admissions",
infect_hosp_rate_dist=InfectHospRate(
dist=dist.LogNormal(jnp.log(0.05), 0.05),
),
)
- model0 = HospitalizationsModel(
+ model0 = HospitalAdmissionsModel(
gen_int=gen_int,
I0=I0,
Rt_process=Rt_process,
latent_infections=latent_infections,
- latent_hospitalizations=latent_hospitalizations,
+ latent_admissions=latent_admissions,
observation_process=DeterministicVariable(0),
)
@@ -102,10 +102,10 @@ def test_model_hosp_no_obs_model():
n_timepoints=30,
)
- inf = model0.spread_draws(["observed_hospitalizations"])
+ inf = model0.spread_draws(["observed_admissions"])
inf_mean = (
inf.group_by("draw")
- .agg(pl.col("observed_hospitalizations").mean())
+ .agg(pl.col("observed_admissions").mean())
.sort(pl.col("draw"))
)
@@ -125,7 +125,7 @@ def test_model_hosp_with_obs_model():
latent_infections = Infections()
Rt_process = RtRandomWalkProcess()
- observed_hospitalizations = PoissonObservation()
+ observed_admissions = PoissonObservation()
inf_hosp = DeterministicPMF(
jnp.array(
@@ -152,20 +152,20 @@ def test_model_hosp_with_obs_model():
),
)
- latent_hospitalizations = HospitalAdmissions(
+ latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp,
infect_hosp_rate_dist=InfectHospRate(
dist=dist.LogNormal(jnp.log(0.05), 0.05),
),
)
- model1 = HospitalizationsModel(
+ model1 = HospitalAdmissionsModel(
gen_int=gen_int,
I0=I0,
Rt_process=Rt_process,
latent_infections=latent_infections,
- latent_hospitalizations=latent_hospitalizations,
- observation_process=observed_hospitalizations,
+ latent_admissions=latent_admissions,
+ observation_process=observed_admissions,
)
# Sampling and fitting model 0 (with no obs for infections)
@@ -177,14 +177,14 @@ def test_model_hosp_with_obs_model():
num_warmup=500,
num_samples=500,
rng_key=jax.random.PRNGKey(272),
- observed_hospitalizations=model1_samp.sampled_admissions,
+ observed_admissions=model1_samp.sampled_admissions,
n_timepoints=30,
)
- inf = model1.spread_draws(["predicted_hospitalizations"])
+ inf = model1.spread_draws(["predicted_admissions"])
inf_mean = (
inf.group_by("draw")
- .agg(pl.col("predicted_hospitalizations").mean())
+ .agg(pl.col("predicted_admissions").mean())
.sort(pl.col("draw"))
)
@@ -204,7 +204,7 @@ def test_model_hosp_with_obs_model_weekday_phosp_2():
latent_infections = Infections()
Rt_process = RtRandomWalkProcess()
- observed_hospitalizations = PoissonObservation()
+ observed_admissions = PoissonObservation()
inf_hosp = DeterministicPMF(
jnp.array(
@@ -240,7 +240,7 @@ def test_model_hosp_with_obs_model_weekday_phosp_2():
hosp_report_prob_dist = UniformProbForTest("hosp_report_prob_dist")
weekday = UniformProbForTest("weekday")
- latent_hospitalizations = HospitalAdmissions(
+ latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp,
weekday_effect_dist=weekday,
hosp_report_prob_dist=hosp_report_prob_dist,
@@ -249,13 +249,13 @@ def test_model_hosp_with_obs_model_weekday_phosp_2():
),
)
- model1 = HospitalizationsModel(
+ model1 = HospitalAdmissionsModel(
I0=I0,
gen_int=gen_int,
Rt_process=Rt_process,
latent_infections=latent_infections,
- latent_hospitalizations=latent_hospitalizations,
- observation_process=observed_hospitalizations,
+ latent_admissions=latent_admissions,
+ observation_process=observed_admissions,
)
# Sampling and fitting model 0 (with no obs for infections)
@@ -267,14 +267,14 @@ def test_model_hosp_with_obs_model_weekday_phosp_2():
num_warmup=500,
num_samples=500,
rng_key=jax.random.PRNGKey(272),
- observed_hospitalizations=model1_samp.sampled_admissions,
+ observed_admissions=model1_samp.sampled_admissions,
n_timepoints=30,
)
- inf = model1.spread_draws(["predicted_hospitalizations"])
+ inf = model1.spread_draws(["predicted_admissions"])
inf_mean = (
inf.group_by("draw")
- .agg(pl.col("predicted_hospitalizations").mean())
+ .agg(pl.col("predicted_admissions").mean())
.sort(pl.col("draw"))
)
@@ -294,7 +294,7 @@ def test_model_hosp_with_obs_model_weekday_phosp():
latent_infections = Infections()
Rt_process = RtRandomWalkProcess()
- observed_hospitalizations = PoissonObservation()
+ observed_admissions = PoissonObservation()
inf_hosp = DeterministicPMF(
jnp.array(
@@ -337,7 +337,7 @@ def test_model_hosp_with_obs_model_weekday_phosp():
hosp_report_prob_dist = DeterministicVariable(vars=hosp_report_prob_dist)
- latent_hospitalizations = HospitalAdmissions(
+ latent_admissions = HospitalAdmissions(
infection_to_admission_interval=inf_hosp,
weekday_effect_dist=weekday,
hosp_report_prob_dist=hosp_report_prob_dist,
@@ -346,13 +346,13 @@ def test_model_hosp_with_obs_model_weekday_phosp():
),
)
- model1 = HospitalizationsModel(
+ model1 = HospitalAdmissionsModel(
I0=I0,
gen_int=gen_int,
Rt_process=Rt_process,
latent_infections=latent_infections,
- latent_hospitalizations=latent_hospitalizations,
- observation_process=observed_hospitalizations,
+ latent_admissions=latent_admissions,
+ observation_process=observed_admissions,
)
# Sampling and fitting model 0 (with no obs for infections)
@@ -369,15 +369,15 @@ def test_model_hosp_with_obs_model_weekday_phosp():
num_warmup=500,
num_samples=500,
rng_key=jax.random.PRNGKey(272),
- observed_hospitalizations=obs,
+ observed_admissions=obs,
n_timepoints=30,
padding=5,
)
- inf = model1.spread_draws(["predicted_hospitalizations"])
+ inf = model1.spread_draws(["predicted_admissions"])
inf_mean = (
inf.group_by("draw")
- .agg(pl.col("predicted_hospitalizations").mean())
+ .agg(pl.col("predicted_admissions").mean())
.sort(pl.col("draw"))
)