diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a3763ce..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..5163d0b --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1 @@ +^LICENSE\.md$ diff --git a/src/RunInterventions-6efeedd1.o.tmp b/.github/.gitignore similarity index 100% rename from src/RunInterventions-6efeedd1.o.tmp rename to .github/.gitignore diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..cb101fb --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,54 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + #r-version: 4.4.1 + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' + error-on: '"error"' \ No newline at end of file diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..0670ef2 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,46 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +permissions: + contents: write + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub Pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + clean: false + branch: gh-pages + folder: docs # Jekyll outputs to the _site folder by default \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa004a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +src/rsvie.so +src/RunInterventions.o +src/RcppExports.o \ No newline at end of file diff --git a/.vscode/c_cpp_proporties.json b/.vscode/c_cpp_proporties.json deleted file mode 100644 index d4d513a..0000000 --- a/.vscode/c_cpp_proporties.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/src", - "${env:HOME}/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include", - "/usr/share/R/include" - ], - "defines": [], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c17", - "cppStandard": "c++17" - }, - { - "name": "Mac", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/src", - "/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include", - "/Library/Frameworks/R.framework/Resources/include", - "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include", - "/usr/local/include" - ], - "defines": [], - "macFrameworkPath": [ - "/System/Library/Frameworks", - "/Library/Frameworks" - ], - "compilerPath": "/usr/bin/clang", - "cStandard": "c21", - "cppStandard": "c++21" - } - ], - - "version": 4 -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 908eca2..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files.associations": { - "vector": "cpp", - "ios": "cpp", - "cmath": "cpp", - "ostream": "cpp" - } -} \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 51212ec..8bbf300 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,21 +5,20 @@ Authors@R: person("David", "Hodgson", , "david.hodgson@lshtm.ac.uk", role = c("aut", "cre"), comment = c(ORCID = "YOUR-ORCID-ID")) Description: What the package does (one paragraph). -License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a - license +License: GPL (>= 3) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Depends: R (>= 4.2) Imports: + methods, here, lubridate, ggplot2, Rcpp, patchwork, RcppEigen, - Rcpp, dplyr, forcats, tidyr, @@ -27,17 +26,23 @@ Imports: RColorBrewer, EnvStats, BH, - magrittr + magrittr, + data.table, + furrr, + future, + purrr, + readr, + stringr Suggests: - gifski, - learnr, + knitr, + rmarkdown, usethis, roxygen2, devtools, - magrittr, testthat (>= 3.0.0) LinkingTo: Rcpp, RcppEigen, BH +VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..175443c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,595 @@ +GNU General Public License +========================== + +_Version 3, 29 June 2007_ +_Copyright © 2007 Free Software Foundation, Inc. <>_ + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +## Preamble + +The GNU General Public License is a free, copyleft license for software and other +kinds of works. + +The licenses for most software and other practical works are designed to take away +your freedom to share and change the works. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change all versions of a +program--to make sure it remains free software for all its users. We, the Free +Software Foundation, use the GNU General Public License for most of our software; it +applies also to any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General +Public Licenses are designed to make sure that you have the freedom to distribute +copies of free software (and charge for them if you wish), that you receive source +code or can get it if you want it, that you can change the software or use pieces of +it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or +asking you to surrender the rights. Therefore, you have certain responsibilities if +you distribute copies of the software, or if you modify it: responsibilities to +respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, +you must pass on to the recipients the same freedoms that you received. You must make +sure that they, too, receive or can get the source code. And you must show them these +terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: **(1)** assert +copyright on the software, and **(2)** offer you this License giving you legal permission +to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is +no warranty for this free software. For both users' and authors' sake, the GPL +requires that modified versions be marked as changed, so that their problems will not +be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of +the software inside them, although the manufacturer can do so. This is fundamentally +incompatible with the aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we have designed +this version of the GPL to prohibit the practice for those products. If such problems +arise substantially in other domains, we stand ready to extend this provision to +those domains in future versions of the GPL, as needed to protect the freedom of +users. + +Finally, every program is threatened constantly by software patents. States should +not allow patents to restrict development and use of software on general-purpose +computers, but in those that do, we wish to avoid the special danger that patents +applied to a free program could make it effectively proprietary. To prevent this, the +GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +## TERMS AND CONDITIONS + +### 0. Definitions + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in +a fashion requiring copyright permission, other than the making of an exact copy. The +resulting work is called a “modified version” of the earlier work or a +work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on +the Program. + +To “propagate” a work means to do anything with it that, without +permission, would make you directly or secondarily liable for infringement under +applicable copyright law, except executing it on a computer or modifying a private +copy. Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through a computer +network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the +extent that it includes a convenient and prominently visible feature that **(1)** +displays an appropriate copyright notice, and **(2)** tells the user that there is no +warranty for the work (except to the extent that warranties are provided), that +licensees may convey the work under this License, and how to view a copy of this +License. If the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +### 1. Source Code + +The “source code” for a work means the preferred form of the work for +making modifications to it. “Object code” means any non-source form of a +work. + +A “Standard Interface” means an interface that either is an official +standard defined by a recognized standards body, or, in the case of interfaces +specified for a particular programming language, one that is widely used among +developers working in that language. + +The “System Libraries” of an executable work include anything, other than +the work as a whole, that **(a)** is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and **(b)** serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code form. +A “Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on which +the executable work runs, or a compiler used to produce the work, or an object code +interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the +source code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. However, +it does not include the work's System Libraries, or general-purpose tools or +generally available free programs which are used unmodified in performing those +activities but which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for the work, and +the source code for shared libraries and dynamically linked subprograms that the work +is specifically designed to require, such as by intimate data communication or +control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +### 2. Basic Permissions + +All rights granted under this License are granted for the term of copyright on the +Program, and are irrevocable provided the stated conditions are met. This License +explicitly affirms your unlimited permission to run the unmodified Program. The +output from running a covered work is covered by this License only if the output, +given its content, constitutes a covered work. This License acknowledges your rights +of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey covered +works to others for the sole purpose of having them make modifications exclusively +for you, or provide you with facilities for running those works, provided that you +comply with the terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for you must do so +exclusively on your behalf, under your direction and control, on terms that prohibit +them from making any copies of your copyrighted material outside their relationship +with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law + +No covered work shall be deemed part of an effective technological measure under any +applicable law fulfilling obligations under article 11 of the WIPO copyright treaty +adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention +of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of +technological measures to the extent such circumvention is effected by exercising +rights under this License with respect to the covered work, and you disclaim any +intention to limit operation or modification of the work as a means of enforcing, +against the work's users, your or third parties' legal rights to forbid circumvention +of technological measures. + +### 4. Conveying Verbatim Copies + +You may convey verbatim copies of the Program's source code as you receive it, in any +medium, provided that you conspicuously and appropriately publish on each copy an +appropriate copyright notice; keep intact all notices stating that this License and +any non-permissive terms added in accord with section 7 apply to the code; keep +intact all notices of the absence of any warranty; and give all recipients a copy of +this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer +support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions + +You may convey a work based on the Program, or the modifications to produce it from +the Program, in the form of source code under the terms of section 4, provided that +you also meet all of these conditions: + +* **a)** The work must carry prominent notices stating that you modified it, and giving a +relevant date. +* **b)** The work must carry prominent notices stating that it is released under this +License and any conditions added under section 7. This requirement modifies the +requirement in section 4 to “keep intact all notices”. +* **c)** You must license the entire work, as a whole, under this License to anyone who +comes into possession of a copy. This License will therefore apply, along with any +applicable section 7 additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no permission to license the +work in any other way, but it does not invalidate such permission if you have +separately received it. +* **d)** If the work has interactive user interfaces, each must display Appropriate Legal +Notices; however, if the Program has interactive interfaces that do not display +Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are +not by their nature extensions of the covered work, and which are not combined with +it such as to form a larger program, in or on a volume of a storage or distribution +medium, is called an “aggregate” if the compilation and its resulting +copyright are not used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work in an aggregate +does not cause this License to apply to the other parts of the aggregate. + +### 6. Conveying Non-Source Forms + +You may convey a covered work in object code form under the terms of sections 4 and +5, provided that you also convey the machine-readable Corresponding Source under the +terms of this License, in one of these ways: + +* **a)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by the Corresponding Source fixed on a +durable physical medium customarily used for software interchange. +* **b)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by a written offer, valid for at least +three years and valid for as long as you offer spare parts or customer support for +that product model, to give anyone who possesses the object code either **(1)** a copy of +the Corresponding Source for all the software in the product that is covered by this +License, on a durable physical medium customarily used for software interchange, for +a price no more than your reasonable cost of physically performing this conveying of +source, or **(2)** access to copy the Corresponding Source from a network server at no +charge. +* **c)** Convey individual copies of the object code with a copy of the written offer to +provide the Corresponding Source. This alternative is allowed only occasionally and +noncommercially, and only if you received the object code with such an offer, in +accord with subsection 6b. +* **d)** Convey the object code by offering access from a designated place (gratis or for +a charge), and offer equivalent access to the Corresponding Source in the same way +through the same place at no further charge. You need not require recipients to copy +the Corresponding Source along with the object code. If the place to copy the object +code is a network server, the Corresponding Source may be on a different server +(operated by you or a third party) that supports equivalent copying facilities, +provided you maintain clear directions next to the object code saying where to find +the Corresponding Source. Regardless of what server hosts the Corresponding Source, +you remain obligated to ensure that it is available for as long as needed to satisfy +these requirements. +* **e)** Convey the object code using peer-to-peer transmission, provided you inform +other peers where the object code and Corresponding Source of the work are being +offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A “User Product” is either **(1)** a “consumer product”, which +means any tangible personal property which is normally used for personal, family, or +household purposes, or **(2)** anything designed or sold for incorporation into a +dwelling. In determining whether a product is a consumer product, doubtful cases +shall be resolved in favor of coverage. For a particular product received by a +particular user, “normally used” refers to a typical or common use of +that class of product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected to use, the +product. A product is a consumer product regardless of whether the product has +substantial commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, +procedures, authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified version of +its Corresponding Source. The information must suffice to ensure that the continued +functioning of the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for +use in, a User Product, and the conveying occurs as part of a transaction in which +the right of possession and use of the User Product is transferred to the recipient +in perpetuity or for a fixed term (regardless of how the transaction is +characterized), the Corresponding Source conveyed under this section must be +accompanied by the Installation Information. But this requirement does not apply if +neither you nor any third party retains the ability to install modified object code +on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to +continue to provide support service, warranty, or updates for a work that has been +modified or installed by the recipient, or for the User Product in which it has been +modified or installed. Access to a network may be denied when the modification itself +materially and adversely affects the operation of the network or violates the rules +and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with +this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. + +### 7. Additional Terms + +“Additional permissions” are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. Additional +permissions that are applicable to the entire Program shall be treated as though they +were included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may be +used separately under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when you +modify the work.) You may place additional permissions on material, added by you to a +covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + +* **a)** Disclaiming warranty or limiting liability differently from the terms of +sections 15 and 16 of this License; or +* **b)** Requiring preservation of specified reasonable legal notices or author +attributions in that material or in the Appropriate Legal Notices displayed by works +containing it; or +* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that +modified versions of such material be marked in reasonable ways as different from the +original version; or +* **d)** Limiting the use for publicity purposes of names of licensors or authors of the +material; or +* **e)** Declining to grant rights under trademark law for use of some trade names, +trademarks, or service marks; or +* **f)** Requiring indemnification of licensors and authors of that material by anyone +who conveys the material (or modified versions of it) with contractual assumptions of +liability to the recipient, for any liability that these contractual assumptions +directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you received +it, or any part of it, contains a notice stating that it is governed by this License +along with a term that is a further restriction, you may remove that term. If a +license document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms of +that license document, provided that the further restriction does not survive such +relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in +the relevant source files, a statement of the additional terms that apply to those +files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements apply +either way. + +### 8. Termination + +You may not propagate or modify a covered work except as expressly provided under +this License. Any attempt otherwise to propagate or modify it is void, and will +automatically terminate your rights under this License (including any patent licenses +granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated **(a)** provisionally, unless and until the +copyright holder explicitly and finally terminates your license, and **(b)** permanently, +if the copyright holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently +if the copyright holder notifies you of the violation by some reasonable means, this +is the first time you have received notice of violation of this License (for any +work) from that copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify to +receive new licenses for the same material under section 10. + +### 9. Acceptance Not Required for Having Copies + +You are not required to accept this License in order to receive or run a copy of the +Program. Ancillary propagation of a covered work occurring solely as a consequence of +using peer-to-peer transmission to receive a copy likewise does not require +acceptance. However, nothing other than this License grants you permission to +propagate or modify any covered work. These actions infringe copyright if you do not +accept this License. Therefore, by modifying or propagating a covered work, you +indicate your acceptance of this License to do so. + +### 10. Automatic Licensing of Downstream Recipients + +Each time you convey a covered work, the recipient automatically receives a license +from the original licensors, to run, modify and propagate that work, subject to this +License. You are not responsible for enforcing compliance by third parties with this +License. + +An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an organization, or +merging organizations. If propagation of a covered work results from an entity +transaction, each party to that transaction who receives a copy of the work also +receives whatever licenses to the work the party's predecessor in interest had or +could give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if the predecessor +has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or +affirmed under this License. For example, you may not impose a license fee, royalty, +or other charge for exercise of rights granted under this License, and you may not +initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging +that any patent claim is infringed by making, using, selling, offering for sale, or +importing the Program or any portion of it. + +### 11. Patents + +A “contributor” is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The work thus +licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, that +would be infringed by some manner, permitted by this License, of making, using, or +selling its contributor version, but do not include claims that would be infringed +only as a consequence of further modification of the contributor version. For +purposes of this definition, “control” includes the right to grant patent +sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license +under the contributor's essential patent claims, to make, use, sell, offer for sale, +import and otherwise run, modify and propagate the contents of its contributor +version. + +In the following three paragraphs, a “patent license” is any express +agreement or commitment, however denominated, not to enforce a patent (such as an +express permission to practice a patent or covenant not to sue for patent +infringement). To “grant” such a patent license to a party means to make +such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of charge +and under the terms of this License, through a publicly available network server or +other readily accessible means, then you must either **(1)** cause the Corresponding +Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the +patent license for this particular work, or **(3)** arrange, in a manner consistent with +the requirements of this License, to extend the patent license to downstream +recipients. “Knowingly relying” means you have actual knowledge that, but +for the patent license, your conveying the covered work in a country, or your +recipient's use of the covered work in a country, would infringe one or more +identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a patent +license to some of the parties receiving the covered work authorizing them to use, +propagate, modify or convey a specific copy of the covered work, then the patent +license you grant is automatically extended to all recipients of the covered work and +works based on it. + +A patent license is “discriminatory” if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on the +non-exercise of one or more of the rights that are specifically granted under this +License. You may not convey a covered work if you are a party to an arrangement with +a third party that is in the business of distributing software, under which you make +payment to the third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties who would receive +the covered work from you, a discriminatory patent license **(a)** in connection with +copies of the covered work conveyed by you (or copies made from those copies), or **(b)** +primarily for and in connection with specific products or compilations that contain +the covered work, unless you entered into that arrangement, or that patent license +was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. + +### 12. No Surrender of Others' Freedom + +If conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot convey a covered work so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not convey it at all. For example, if you +agree to terms that obligate you to collect a royalty for further conveying from +those to whom you convey the Program, the only way you could satisfy both those terms +and this License would be to refrain entirely from conveying the Program. + +### 13. Use with the GNU Affero General Public License + +Notwithstanding any other provision of this License, you have permission to link or +combine any covered work with a work licensed under version 3 of the GNU Affero +General Public License into a single combined work, and to convey the resulting work. +The terms of this License will continue to apply to the part which is the covered +work, but the special requirements of the GNU Affero General Public License, section +13, concerning interaction through a network will apply to the combination as such. + +### 14. Revised Versions of this License + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in spirit +to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that +a certain numbered version of the GNU General Public License “or any later +version” applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by the +Free Software Foundation. If the Program does not specify a version number of the GNU +General Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU +General Public License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no +additional obligations are imposed on any author or copyright holder as a result of +your choosing to follow a later version. + +### 15. Disclaimer of Warranty + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +### 16. Limitation of Liability + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE +OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE +WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16 + +If the disclaimer of warranty and limitation of liability provided above cannot be +given local legal effect according to their terms, reviewing courts shall apply local +law that most closely approximates an absolute waiver of all civil liability in +connection with the Program, unless a warranty or assumption of liability accompanies +a copy of the Program in return for a fee. + +_END OF TERMS AND CONDITIONS_ + +## How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to +the public, the best way to achieve this is to make it free software which everyone +can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them +to the start of each source file to most effectively state the exclusion of warranty; +and each file should have at least the “copyright” line and a pointer to +where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this +when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands `show w` and `show c` should show the appropriate parts of +the General Public License. Of course, your program's commands might be different; +for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to +sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +<>. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider it +more useful to permit linking proprietary applications with the library. If this is +what you want to do, use the GNU Lesser General Public License instead of this +License. But first, please read +<>. diff --git a/NAMESPACE b/NAMESPACE index d29af35..153a1bc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,38 +1,74 @@ # Generated by roxygen2: do not edit by hand export(add_economics) +export(add_fitted_dist) export(add_programme) export(calculate_daily_uptake) export(checkout_incidence) export(checkout_states) export(compare_interventions) +export(convert_efficacies) export(convert_to_outcomes) export(covert_raw_to_risk) -export(get_efficacies_sample) +export(get_averted_df) +export(get_coverage) +export(get_daily_uptake) export(make_RunInterventions) export(make_rsv_programme) export(output_samples) export(plot_calendar) export(plot_economics) -export(plot_economics_fit) export(plot_outcomes) export(run) export(run_state) +export(summarise_outcomes) exportClasses(RSVProgramme) exportMethods(add_economics) exportMethods(add_programme) exportMethods(run) exportMethods(run_state) -import(data.table) import(dplyr) import(furrr) import(future) import(ggplot2) -import(lubridate) +import(here) import(purrr) import(readr) -import(stringr) -importFrom(EnvStats,rtri) +import(tidyr) +importFrom(data.table,as.data.table) +importFrom(dplyr,"%>%") +importFrom(dplyr,bind_cols) +importFrom(dplyr,bind_rows) +importFrom(dplyr,filter) +importFrom(dplyr,mutate) +importFrom(dplyr,rename_with) +importFrom(dplyr,select) +importFrom(ggplot2,aes) +importFrom(ggplot2,facet_grid) +importFrom(ggplot2,facet_wrap) +importFrom(ggplot2,geom_boxplot) +importFrom(ggplot2,geom_line) +importFrom(ggplot2,geom_ribbon) +importFrom(ggplot2,geom_tile) +importFrom(ggplot2,ggplot) +importFrom(ggplot2,ggsave) +importFrom(ggplot2,labs) +importFrom(ggplot2,scale_fill_gradient) +importFrom(ggplot2,scale_y_continuous) +importFrom(ggplot2,theme) +importFrom(ggplot2,theme_bw) +importFrom(here,here) +importFrom(lubridate,dmy) +importFrom(lubridate,yday) +importFrom(lubridate,year) +importFrom(lubridate,ymd) +importFrom(magrittr,"%>%") importFrom(magrittr,`%>%`) +importFrom(purrr,map) +importFrom(purrr,map_dbl) +importFrom(purrr,map_df) +importFrom(stats,optim) +importFrom(stats,quantile) importFrom(tidyr,pivot_longer) +importFrom(utils,read.table) useDynLib(rsvie) diff --git a/R/add_economics_methods.R b/R/add_economics_methods.R index 37bd9ff..a40f161 100644 --- a/R/add_economics_methods.R +++ b/R/add_economics_methods.R @@ -1,6 +1,23 @@ -## Add uncertainty to costs and qalys +#' Add Fitted Distribution to Data Frame +#' +#' This function fits a specified distribution to the data in a given data frame and adds the fitted distribution as a new column. +#' +#' @param cost_df A data frame containing the data to which the distribution will be fitted. The data frame should have columns named "mean", "lb_95", and "ub_95". +#' @param dist A character string specifying the distribution to fit. The distribution should be one of the distributions supported by the `q` function in R (e.g., "norm" for normal distribution, "tri" for triangular distribution). +#' +#' @return A data frame with an additional column named `fitt_dist` containing the fitted distribution for each row. +#' +#' @examples +#' \dontrun{ +#' cost_df <- data.frame(mean = c(10, 20), lb_95 = c(5, 15), ub_95 = c(15, 25)) +#' add_fitted_dist(cost_df, "norm") +#' } +#' +#' @importFrom stats optim +#' @importFrom purrr map_dbl +#' @importFrom dplyr %>% +#' @export add_fitted_dist <- function(cost_df, dist) { - fitdist_ci <- function(pars, data, dist) { qs <- c(0.025, 0.5, 0.975); 1:3 %>% map_dbl(~ (dist(qs[.x], pars[1], pars[2]) - data[.x])^2) %>% sum } @@ -25,34 +42,47 @@ add_fitted_dist <- function(cost_df, dist) { cost_df } -#' @title Convert mean and ci into samples from a fitted distribution + +#' Generate and output samples for economic and risk data #' -#' @description Convert mean and ci into samples from a fitted distribution. -#' @param econ_raw a dataframe with the economic parameters per age group. -#' @param risks_raw a dataframe with the risk of outcomes per age group. +#' This function processes raw economic and risk data, fits distributions to the data, +#' generates samples, and outputs the results to a specified file. +#' +#' @param econ_raw A data frame containing raw economic data with columns for age group, outcome, reference QALYs, mean QALYs, lower bound QALYs, and upper bound QALYs. +#' @param risks_raw A data frame containing raw risk data. +#' @param file.name A string specifying the name of the output file. +#' +#' @return A list containing sampled outcomes for risks, QALYs, and costs. +#' +#' @details +#' The function performs the following steps: +#' \itemize{ +#' \item Fits triangular distributions to the risk, QALY, and cost data. +#' \item Generates samples for each outcome using the fitted distributions. +#' \item Outputs the sampled outcomes to the specified file. +#' } +#' +#' @examples +#' \dontrun{ +#' econ_raw <- read.csv("economic_data.csv") +#' risks_raw <- read.csv("risk_data.csv") +#' output_samples(econ_raw, risks_raw, "output_samples.csv") +#' } #' -#' @import stringr -#' @import dplyr -#' @import ggplot2 -#' @import purrr -#' @importFrom EnvStats rtri #' @export output_samples <- function(econ_raw, risks_raw, file.name) { + require(EnvStats) + risks_uncert <- add_fitted_dist(risks_raw, "tri") qalys_raw <- econ_raw %>% select(age_group, outcome, ref_qaly, mean_qaly, lb_95_qaly, ub_95_qaly) %>% - rename_with(~ str_remove(., "_qaly")) + rename_with(~ stringr::str_remove(., "_qaly")) costs_raw <- econ_raw %>% select(age_group, outcome, ref_costs, mean_costs, lb_95_costs, ub_95_costs) %>% - rename_with(~ str_remove(., "_costs")) + rename_with(~ stringr::str_remove(., "_costs")) costs_uncert <- add_fitted_dist(costs_raw, "tri") qalys_uncert <- add_fitted_dist(qalys_raw, "tri") - # inner workings - # write.csv(risks_uncert, file = here::here("data", "inner_workings", paste0("outcome_risks_", file.name,"_dist.csv"))) - # write.csv(qalys_uncert, file = here::here("data", "inner_workings", "outcome_qalys_dist.csv")) - # write.csv(costs_uncert, file = here::here("data", "inner_workings", "outcome_costs_dist.csv")) - run_samples_outcomes <- function(df_uncert, type = "risk") { outcomes <- df_uncert$outcome %>% unique risk_samples <- list() @@ -82,6 +112,24 @@ output_samples <- function(econ_raw, risks_raw, file.name) { } +#' @title Plot Economics Data +#' @description This function generates and saves plots for economic data, risks data, and very high-risk data from the given object. +#' @param object An object containing economic data frames (`econ_df`, `risks_df`, `risks_vhr_df`) and an economic name (`econ_name`). +#' @details The function performs the following steps: +#' \itemize{ +#' \item Checks if the directory for saving plots exists, and creates it if it does not. +#' \item Processes the economic data frame (`econ_df`) to create a combined data frame for QALY loss and Costs. +#' \item Generates and saves a plot for the economic data with uncertainty ribbons and lines. +#' \item Generates and saves a plot for the risks data with uncertainty ribbons and lines. +#' \item Generates and saves a plot for the very high-risk data with lines. +#' } +#' @import ggplot2 +#' @import dplyr +#' @import here +#' @importFrom magrittr %>% +#' @importFrom ggplot2 ggplot geom_ribbon geom_line facet_grid scale_y_continuous labs theme_bw ggsave +#' @importFrom dplyr bind_rows rename_with mutate filter +#' @importFrom here here #' @export plot_economics <- function(object) { @@ -98,7 +146,7 @@ plot_economics <- function(object) { mutate(econ_metric = "QALY loss"), object@econ_df[, c(1:2, 7:10)] %>% rename_with(~gsub("_costs$", "", .), c("ref_costs", "mean_costs", "lb_95_costs", "ub_95_costs")) %>% - mutate(econ_metric = "Costs (£)") + mutate(econ_metric = "Costs (GBP)") ) @@ -134,7 +182,39 @@ plot_economics <- function(object) { } -#' @export + + +#' @title Plot Economic Fit +#' +#' @description This function generates and saves plots comparing fitted distributions to reference data for risks, QALYs, and costs across different age groups. +#' +#' @param object An S4 object containing economic data and model outcomes. +#' +#' @details The function performs the following steps: +#' \itemize{ +#' \item Checks if the directory for saving plots exists, and creates it if it doesn't. +#' \item Extracts unique age groups from the economic data. +#' \item Defines a helper function to extract mean and 95% uncertainty intervals for model outcomes. +#' \item Extracts fitted model outcomes for risks, QALYs, and costs. +#' \item Prepares data frames for risks, QALYs, and costs by merging reference data with fitted model outcomes. +#' \item Defines a helper function to convert data frames to long format for plotting. +#' \item Converts the prepared data frames to long format. +#' \item Generates and saves plots comparing fitted model outcomes to reference data for risks, QALYs, and costs. +#' } +#' +#' @return None. The function saves the generated plots to the specified directory. +#' +#' @import dplyr +#' @import ggplot2 +#' @import purrr +#' @import here +#' @importFrom stats quantile +#' @importFrom dplyr bind_cols +#' +#' @examples +#' \dontrun{ +#' plot_economics_fit(my_economic_model) +#' } plot_economics_fit <- function(object) { if (!dir.exists(here::here("outputs", object@econ_name, "figs"))) { @@ -209,6 +289,35 @@ plot_economics_fit <- function(object) { } + +#' Convert Raw Outcomes to Risk +#' +#' This function converts raw outcome data to risk metrics based on population data and model cases sample mean. +#' +#' @param object An object containing UK population data. +#' @param outcomes_raw A data frame containing raw outcome data. +#' @param model_cases_sample_mean A data frame containing model cases sample mean. +#' +#' @return A data frame with calculated risk metrics for each age group and outcome. +#' +#' @details +#' The function performs the following steps: +#' \itemize{ +#' \item Extracts population and age group data from the input object. +#' \item Defines helper functions to check the completeness of data and calculate risk per infection. +#' \item Checks that each outcome has data for all age groups. +#' \item Combines raw outcomes data with model cases data and population data. +#' \item Calculates the risk per infection for each outcome and age group. +#' } +#' +#' @examples +#' \dontrun{ +#' result <- covert_raw_to_risk(object, outcomes_raw, model_cases_sample_mean) +#' print(result) +#' } +#' +#' @import dplyr +#' @import tidyr #' @export covert_raw_to_risk <- function(object, outcomes_raw, model_cases_sample_mean) { diff --git a/R/add_programme_methods.R b/R/add_programme_methods.R index 557f57d..cbbc9e5 100644 --- a/R/add_programme_methods.R +++ b/R/add_programme_methods.R @@ -1,12 +1,19 @@ - - -#' @title Convert daily uptake from calendar to model -#' -#' @description Convert mean and ci into samples from a fitted distribution. -#' @param object am S4 class of the defined RSV programme -#' @param cal_df a dataframe of a calendar being evaluated -#' -#' @import lubridate +#' @title Calculate Daily Uptake +#' @description This function calculates the daily uptake for different age groups based on the provided calibration data frame. +#' @param object An object containing the UK data with age group boundaries. +#' @param cal_df A data frame containing the start and end dates, and uptake types for each age group. +#' @return A matrix with 365 rows (days) and 25 columns (age groups) representing the daily uptake. +#' @details The function processes each age group, calculates the start and end positions within the year, and fills the uptake matrix accordingly. +#' Different uptake types such as "linear", "birth_rate", "flu_oa", and "oa_2425" are handled. +#' @examples +#' \dontrun{ +#' object <- your_object_with_uk_data +#' cal_df <- your_calibration_data_frame +#' daily_uptake_matrix <- calculate_daily_uptake(object, cal_df) +#' } +#' @importFrom lubridate dmy ymd year yday +#' @importFrom magrittr %>% +#' @importFrom utils read.table #' @export calculate_daily_uptake <- function(object, cal_df) { @@ -66,13 +73,20 @@ calculate_daily_uptake <- function(object, cal_df) { } -#' Function to convert a custom weekly uptake vector into a daily uptake calendar -#' -#' @param up_week_raw A vector of weekly uptake proportions -#' @param start_time Start week when administration occurs -#' @return A vector of the daily proportion of a target group which are vaccinated. -get_daily_uptake <- function(up_week_raw, start_time) -{ +#' @title Calculate Daily Uptake from Weekly Data +#' @description This function calculates the daily uptake based on weekly uptake data. +#' @param up_week_raw A numeric vector containing the weekly uptake data. +#' @param start_time An integer representing the start time in days. +#' @return A numeric vector of length 365 representing the daily uptake. +#' @details The function first processes the weekly data to fill a weekly uptake vector, then calculates the daily uptake by interpolating the weekly data. +#' @examples +#' \dontrun{ +#' up_week_raw <- c(0.1, 0.2, 0.3, 0.4, 0.5) +#' start_time <- 1 +#' daily_uptake <- get_daily_uptake(up_week_raw, start_time) +#' } +#' @export +get_daily_uptake <- function(up_week_raw, start_time) { up_week <- vector("numeric", length = 52) up_day <- vector("numeric", length = 365) for (k in (start_time):(start_time + 20)) { @@ -82,19 +96,39 @@ get_daily_uptake <- function(up_week_raw, start_time) } for (i in 1:365) { - pos_day <- (i - 1 + start_time) %% 365 + 1; - up_day[pos_day] <- (up_week[((i / 7 + start_time) %% 52) + 1] - up_week[((i / 7 - 1 + start_time) %% 52) + 1]) / 7.0; + pos_day <- (i - 1 + start_time) %% 365 + 1 + up_day[pos_day] <- (up_week[((i / 7 + start_time) %% 52) + 1] - up_week[((i / 7 - 1 + start_time) %% 52) + 1]) / 7.0 if (up_day[pos_day] < 0) up_day[pos_day] <- 0 } up_day } -#' @title function to plot the dosing calendar of the RSVprogramme] -#' -#' @param object an RSVProgramme object -#' @import dplyr -#' @return none + + +#' @title Plot Dosing Calendar +#' @description This function generates and saves a plot of the dosing calendar for different age groups. +#' @param object An object containing the dosing calendar and other relevant data. +#' @details The function performs the following steps: +#' \itemize{ +#' \item Checks if the directory for saving the plot exists, and creates it if it does not. +#' \item Extracts unique age groups from the economic data frame within the object. +#' \item Updates the column names of the dose calendar matrices to match the age groups. +#' \item Converts the dose calendar matrices into a data frame suitable for plotting. +#' \item Generates a ggplot of the dosing calendar, with days of the year on the x-axis, age groups on the y-axis, and the proportion of doses as the fill color. +#' \item Saves the plot as a PNG file in the specified directory. +#' } +#' @importFrom here here +#' @importFrom ggplot2 ggplot geom_tile facet_wrap scale_fill_gradient theme_bw theme labs ggsave +#' @importFrom dplyr mutate +#' @importFrom tidyr pivot_longer +#' @importFrom purrr map map_df +#' @importFrom magrittr %>% +#' @return None +#' @examples +#' \dontrun{ +#' plot_calendar(my_object) +#' } #' @export plot_calendar <- function(object) { if (!dir.exists(here::here("outputs", "extra", object@prog_name, "figs"))) { @@ -123,6 +157,25 @@ plot_calendar <- function(object) { } + +#' Convert Matrices to Transmission Calendar +#' +#' This function converts dose and sero matrices into a transmission calendar based on the provided immune profile. +#' +#' @param all_dose A matrix representing all doses. +#' @param all_sero A matrix representing all sero values. +#' @param cal_vhr A calendar matrix for very high risk (VHR) individuals. +#' @param daily_uptake_vhr A matrix representing daily uptake for VHR individuals. +#' @param cal A calendar matrix for the general population. +#' @param daily_uptake A matrix representing daily uptake for the general population. +#' @param immune_profile A list containing immune profiles for VHR and general population. +#' +#' @details +#' The function first creates a VHR calendar if the immune profile for VHR is not "none". It then calculates the sero and dose models using the `get_sero_dose_cals` helper function. The results are stored in the `all_sero` and `all_dose` matrices. +#' +#' The `get_sero_dose_cals` function calculates the dose and sero models based on the provided calendar, daily uptake, and immune profile. It considers different sero delays and coverage values. +#' +#' @return A list containing updated `dose` and `sero` matrices. convert_mat_to_trans_cal <- function(all_dose, all_sero, cal_vhr, daily_uptake_vhr, cal, daily_uptake, immune_profile) { @@ -206,6 +259,37 @@ convert_mat_to_trans_cal <- function(all_dose, all_sero, cal_vhr, daily_uptake_v list(dose = all_dose, sero = all_sero) } + + +#' Convert Immune Profile to Efficacies +#' +#' This function takes an immune profile and converts it into a list of efficacies for different products. +#' +#' @param immune_profile A list containing immune profile information. It should have the following structure: +#' \describe{ +#' \item{vhr}{A list with element \code{b} representing the efficacy for very high risk (VHR) individuals.} +#' \item{mass}{A list with elements \code{b} and \code{product} representing the efficacy and product type for mass immunization. The \code{product} can be "lav", "mab", or "mat".} +#' } +#' +#' @return A list with the following elements: +#' \describe{ +#' \item{mab_vhr}{Efficacy for monoclonal antibodies (MAB) in very high risk individuals.} +#' \item{mab_mass}{Efficacy for monoclonal antibodies (MAB) in mass immunization.} +#' \item{lav_mass}{Efficacy for live attenuated vaccines (LAV) in mass immunization.} +#' \item{mat_mass}{Efficacy for maternal antibodies (MAT) in mass immunization.} +#' } +#' +#' @details +#' The function initializes the efficacy list with zeros. It then checks if the immune profile contains efficacy values for VHR and mass immunization and updates the efficacy list accordingly. +#' +#' @examples +#' immune_profile <- list( +#' vhr = list(b = 0.8), +#' mass = list(b = 0.6, product = "lav") +#' ) +#' convert_efficacies(immune_profile) +#' +#' @export convert_efficacies <- function(immune_profile) { # add info on waning rates here efficacy_list <- list( @@ -230,6 +314,17 @@ convert_efficacies <- function(immune_profile) { efficacy_list } + +#' @title Get Coverage +#' @description This function calculates the coverage based on the immune profile mass and calibration data. +#' @param immune_profile_mass A data frame containing the immune profile mass information. +#' @param cal A data frame containing the calibration data. +#' @return The coverage value. If the product in the immune profile mass is "mat", it returns the mean of the positive coverage values from the calibration data. Otherwise, it returns 0. +#' @examples +#' immune_profile_mass <- data.frame(product = "mat") +#' cal <- data.frame(cov = c(0.1, 0.2, 0, -0.1)) +#' get_coverage(immune_profile_mass, cal) +#' @export get_coverage <- function(immune_profile_mass, cal) { if(immune_profile_mass$product == "mat") { cov <- mean(cal$cov[cal$cov > 0]) @@ -237,4 +332,4 @@ get_coverage <- function(immune_profile_mass, cal) { cov <- 0 } cov -} +} \ No newline at end of file diff --git a/R/create_data.R b/R/no_run/create_data.R similarity index 100% rename from R/create_data.R rename to R/no_run/create_data.R diff --git a/R/programmeClass.R b/R/programmeClass.R index 395d1d5..c4452dd 100644 --- a/R/programmeClass.R +++ b/R/programmeClass.R @@ -1,4 +1,31 @@ # Define the S4 class for the RSV intervention programme +#' @title RSVProgramme Class +#' @description A class to represent an RSV (Respiratory Syncytial Virus) Programme. +#' @slot econ_name A character string representing the economic name. +#' @slot prog_name A character string representing the programme name. +#' @slot model An object of class refClass representing the model. +#' @slot uk_data A list containing UK data. +#' @slot model_par A list of model parameters. +#' @slot econ_par A list of economic parameters. +#' @slot model_calendar A list representing the model calendar. +#' @slot dose_calendar A list representing the dose calendar. +#' @slot immune_profile A list representing the immune profile. +#' @slot econ_df A data.frame containing economic data. +#' @slot risks_df A data.frame containing risk data. +#' @slot risks_vhr_df A data.frame containing very high risk data. +#' @slot outcomes_vec A vector of outcomes. +#' @slot post A data.frame containing posterior data. +#' @slot seeds A vector of seeds. +#' @slot S A numeric value. +#' @slot raw_inci A list of raw incidence data. +#' @slot wane_func_string A character string representing the waning function. +#' @slot wane_func_string_vhr A character string representing the waning function for very high risk. +#' @slot outcomes A list of outcomes. +#' @slot samples_outcomes A list of sample outcomes. +#' @slot samples_outcomes_VHR A list of sample outcomes for very high risk. +#' @slot efficacies A vector of efficacies. +#' @slot cov_mat A numeric matrix representing the covariance matrix. +#' @slot full_output A logical value indicating whether to produce full output. #' @export setClass( "RSVProgramme", @@ -123,18 +150,42 @@ make_rsv_programme <- function(S = 10) { ) } + +#' @title Add Economics Data to an Object +#' @description This generic function is used to add economics data to a specified object. +#' @param object The object to which the economics data will be added. +#' @param econ_name A character string representing the name of the economics data. +#' @param econ_raw The raw economics data to be added. +#' @param risks_raw The raw risks data associated with the economics data. +#' @param risks_vhr_raw The raw very high risk data associated with the economics data. +#' @return The object with the added economics data. #' @export setGeneric("add_economics", function(object, econ_name, econ_raw, risks_raw, risks_vhr_raw) { standardGeneric("add_economics") }) -#' @title A setMethod for the `add_economics` function -#' -#' @param econ_name a string for the name gven the economic framework given -#' @param econ_raw a dataframe with the economic parameters per age group. -#' @param risks_raw a dataframe with the risk of outcomes per age group. -#' @param risks_vhr_raw a dataframe with the risk of outcomes per age group for very-high-risk infants -#' @return An RSVProgramme object + +#' @title Add Economics Data to RSVProgramme Object +#' @description This method adds economic data to an RSVProgramme object. +#' @param object An object of class \code{RSVProgramme}. +#' @param econ_name A character string representing the name of the economic data. +#' @param econ_raw A data frame containing the raw economic data. +#' @param risks_raw A data frame containing the raw risks data. +#' @param risks_vhr_raw A data frame containing the raw very high risk (VHR) data. +#' @return The updated \code{RSVProgramme} object with the added economic data. +#' @details This method performs the following steps: +#' \itemize{ +#' \item Checks if the output directory for the economic data exists, and creates it if it does not. +#' \item Assigns the provided economic data and risk data to the corresponding slots in the \code{RSVProgramme} object. +#' \item Extracts unique outcomes from the economic data and assigns them to the \code{outcomes_vec} slot. +#' \item Stops execution if no outcomes are detected in the economic data. +#' \item Generates samples of outcomes and assigns them to the \code{samples_outcomes} and \code{samples_outcomes_VHR} slots. +#' } +#' @examples +#' \dontrun{ +#' rsv_programme <- new("RSVProgramme") +#' rsv_programme <- add_economics(rsv_programme, "econ_data", econ_raw_df, risks_raw_df, risks_vhr_raw_df) +#' } #' @export setMethod("add_economics", signature(object = "RSVProgramme"), function(object, econ_name, econ_raw, risks_raw, risks_vhr_raw) { @@ -157,19 +208,30 @@ setMethod("add_economics", signature(object = "RSVProgramme"), } ) + +#' @title Add Programme +#' @description This function is a generic method for adding a programme to an object. +#' @param object The object to which the programme will be added. +#' @param prog_name The name of the programme to be added. +#' @param cal The calendar associated with the programme. +#' @param cal_vhr The calendar with very high resolution associated with the programme. +#' @param immune_profile The immune profile associated with the programme. +#' @return The object with the added programme. #' @export setGeneric("add_programme", function(object, prog_name, cal, cal_vhr, immune_profile) { standardGeneric("add_programme") }) -#' @title A setMethod for the `add_programme` function -#' -#' @param prog_name an integer taking the number of Monte Carlo samples to run over -#' @param cal a dataframe with the implementation calendar for the population -#' @param cal_vhr dataframe with the implementation calendar for the very-high-risk population -#' @param immune_profile a list with information about the immune asumptions if the prophylatic in the programme -#' @return An RSVProgramme object +#' @title Add Programme to RSVProgramme Object +#' @description This method adds a programme to an RSVProgramme object, setting various attributes and creating necessary directories. +#' @param object An object of class \code{RSVProgramme}. +#' @param prog_name A character string representing the name of the programme. +#' @param cal A calendar object used for the programme. +#' @param cal_vhr A calendar object for very high-risk (VHR) groups. +#' @param immune_profile A list containing the immune profile information. +#' @return The updated \code{RSVProgramme} object with the new programme added. +#' @details This function sets the programme name, checks and creates necessary directories, initializes dose and sero matrices, calculates daily uptake, converts matrices to transmission calendars, and sets various attributes in the \code{RSVProgramme} object. #' @export setMethod("add_programme", signature(object = "RSVProgramme"), function(object, prog_name, cal, cal_vhr, immune_profile) { @@ -217,6 +279,14 @@ setMethod("add_programme", signature(object = "RSVProgramme"), } ) + +#' @title Run Method +#' @description Generic function to execute a specific operation. +#' @param object The object on which the operation is performed. +#' @param direct A logical value indicating whether to run the operation directly. +#' @param filename An optional character string specifying the filename. +#' @param yr_num An integer specifying the number of years, default is 2. +#' @return The result of the operation. #' @export setGeneric("run", function(object, direct = FALSE, filename = NULL, yr_num = 2) { standardGeneric("run") @@ -224,8 +294,10 @@ setGeneric("run", function(object, direct = FALSE, filename = NULL, yr_num = 2) #' @title A setMethod for the `run` function #' -#' @param object RSVProgramme object -#' @return An RSVProgramme object +#' @param object The object on which the operation is performed. +#' @param direct A logical value indicating whether to run the operation directly. +#' @param filename An optional character string specifying the filename. +#' @param yr_num An integer specifying the number of years, default is 2.#' @return An RSVProgramme object #' @import furrr #' @import future #' @export @@ -233,7 +305,7 @@ setMethod("run", signature(object = "RSVProgramme"), function(object, direct = FALSE, filename = NULL, yr_num = 2) { cat("Running: Iterating through model simulations\n") - future::plan(multisession, workers = 16) + # future::plan(multisession, workers = 1) raw_inci <- map(seq_len(object@S), function(x) { @@ -268,6 +340,13 @@ setMethod("run", signature(object = "RSVProgramme"), } ) + +#' @title Run State Generic Function +#' @description This is a generic function for running a state. +#' @param object An object on which the state is to be run. +#' @param S_i An integer representing the state index. Default is 1. +#' @param direct A logical value indicating whether to run the state directly. Default is FALSE. +#' @return The result of the state run, depending on the method implementation. #' @export setGeneric("run_state", function(object, S_i = 1, direct = FALSE) { standardGeneric("run_state") @@ -275,7 +354,9 @@ setGeneric("run_state", function(object, S_i = 1, direct = FALSE) { #' @title A setMethod for the `run_state` function #' -#' @param object RSVProgramme object +#' @param object An object on which the state is to be run. +#' @param S_i An integer representing the state index. Default is 1. +#' @param direct A logical value indicating whether to run the state directly. Default is FALSE. #' @return a matrix with all the values of the state variables in the dynamic transmission model #' @export setMethod("run_state", signature(object = "RSVProgramme"), diff --git a/R/run_methods.R b/R/run_methods.R index df53b9f..5bda54e 100644 --- a/R/run_methods.R +++ b/R/run_methods.R @@ -1,3 +1,25 @@ +#' @title Convert to Outcomes +#' @description This function processes an object to calculate various health outcomes over time. +#' @param object An object containing the necessary data for processing. +#' @param yrsum An integer specifying the number of years to summarize. Default is 2. +#' @return A list containing the following elements: +#' \item{outcomes}{A data frame with weekly outcomes by age group.} +#' \item{costs}{A data frame with discounted costs by outcome and age group.} +#' \item{qaly}{A data frame with discounted quality-adjusted life years (QALYs) by outcome and age group.} +#' \item{doses}{A vector containing the number of doses administered.} +#' @details The function performs the following steps: +#' \enumerate{ +#' \item Extracts necessary data from the input object. +#' \item Calculates the proportion of individuals in different states over time. +#' \item Estimates the incidence of various health outcomes for vaccinated and unvaccinated groups. +#' \item Computes the protected incidence for different health outcomes. +#' \item Aggregates the results to provide weekly outcomes, costs, and QALYs by age group. +#' \item Applies discounting to costs and QALYs. +#' } +#' @examples +#' \dontrun{ +#' result <- convert_to_outcomes(my_object, yrsum = 3) +#' } #' @export convert_to_outcomes <- function(object, yrsum = 2) { @@ -96,10 +118,12 @@ convert_to_outcomes <- function(object, yrsum = 2) { # Get the risk, incidence, costs and qalys outcome_per_sample <- list() + # cat("S: ", S, "\n") for (s in 1:S) { outcome_per_sample[[s]] <- outcomes_vec %>% map_df( function(x) { + inci_risk_hc <- t(LR_inci[[s]] * (1 - LR_prot[[x]])) inci_risk_hc_vhr <- t(VHR_inci[[s]] * (1 - VHR_prot[[x]])) @@ -116,6 +140,8 @@ convert_to_outcomes <- function(object, yrsum = 2) { ) } + + outcomes_week_age <- outcome_per_sample %>% bind_rows dis_qaly_df <- outcomes_week_age %>% mutate(qaly = qaly * exp(-(week_no * discount_rate / 52.0))) %>% group_by(outcome, age_group, s) %>% summarise(qaly = sum(qaly)) @@ -139,6 +165,23 @@ convert_to_outcomes <- function(object, yrsum = 2) { outcomes } + +#' @title Plot Outcomes +#' @description This function loads the run outputs from a specified file, extracts the outcomes data, and creates a boxplot of costs and QALY (Quality-Adjusted Life Year) outcomes. The plot is saved as a PNG file. +#' @param object An S4 object that contains the program name and outcomes data. +#' @return A ggplot object representing the boxplot of costs and QALY outcomes. +#' @details The function performs the following steps: +#' \itemize{ +#' \item Loads the run outputs from a file located in the "outputs" directory. +#' \item Extracts the outcomes data from the loaded object. +#' \item Binds the costs and QALY data into a single data frame. +#' \item Creates a boxplot of the costs and QALY data using ggplot2. +#' \item Saves the plot as a PNG file in the "figs" subdirectory of the "outputs" directory. +#' } +#' @importFrom here here +#' @importFrom ggplot2 ggplot geom_boxplot aes scale_y_continuous ggsave +#' @importFrom dplyr bind_rows select mutate +#' @importFrom magrittr %>% #' @export plot_outcomes <- function(object) { object_get <- load(file = here::here("outputs", @@ -179,7 +222,19 @@ get_model_sample <- function(object, seed) { model_calendar_sample } -#' @export + +#' @title Get Efficacies Sample +#' @description This function retrieves a sample of efficacies from an object based on a provided seed. +#' @param object An object containing efficacies in a list format. +#' @param seed An integer representing the seed to select the sample from the efficacies. +#' @return A list containing the sampled efficacies for each efficacy type. +#' @details The function initializes a list with efficacy types set to 0. It then iterates over the names of the efficacy types and checks if the length of the efficacy values for each type is greater than 1. If so, it selects the efficacy value based on the provided seed. Otherwise, it assigns the single efficacy value to the list. The function finally returns the list of sampled efficacies. +#' @examples +#' \dontrun{ +#' object <- list(efficacies = list(mab_vhr = c(0.1, 0.2), mab_mass = 0.3, lav_mass = c(0.4, 0.5), mat_mass = 0.6)) +#' seed <- 1 +#' get_efficacies_sample(object, seed) +#' } get_efficacies_sample <- function(object, seed) { efficacy_sample_list <- list( mab_vhr = 0, diff --git a/R/utils.R b/R/utils.R index 3cb56d1..7fe524c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -3,8 +3,17 @@ #' @param object an RSVProgramme object #' @importFrom tidyr pivot_longer #' @return none +#' @title Checkout Incidence +#' @description This function processes the incidence data from an object. +#' @param object An object containing the raw incidence data. +#' @param rerun A logical value indicating whether to rerun the `rsvie::run` function on the object. Default is TRUE. +#' @return A data frame containing the processed incidence data with additional columns for time, age group, social group, and risk group. +#' @examples +#' \dontrun{ +#' result <- checkout_incidence(my_object) +#' } #' @export -checkout_incidence <- function(object, rerun = TRUE) { +checkout_incidence <- function(object, rerun = FALSE) { if (rerun) { object <- rsvie::run(object) } @@ -19,12 +28,17 @@ checkout_incidence <- function(object, rerun = TRUE) { inci_df } -#' @title function to conver the incidence matrix from a state run to a data.frame -#' -#' @param object an RSVProgramme object + +#' @title Checkout States +#' @description This function processes the states of a given object and returns a data table with detailed information about each state. +#' @param object An object containing the states to be processed. +#' @return A data table with columns for time, incidence, age group, risk group, social group, model type, and state name. +#' @details The function generates a list of state names and categorizes them into risk groups, social groups, and model types. It then runs the state function on the input object and processes the resulting states into a data frame. The data frame is then transformed into a long format and additional columns are added to provide detailed information about each state. +#' @importFrom dplyr mutate #' @importFrom tidyr pivot_longer -#' @import data.table -#' @return none +#' @importFrom data.table as.data.table +#' @importFrom purrr map +#' @importFrom magrittr %>% #' @export checkout_states <- function(object) { inner <- c( @@ -62,6 +76,19 @@ checkout_states <- function(object) { df_states %>% as.data.table } + + +#' Compare Interventions +#' +#' This function compares the outcomes of a base intervention with multiple other interventions. +#' +#' @param obj_base An object containing the outcomes of the base intervention. +#' @param obj_inter A list of objects, each containing the outcomes of different interventions to be compared with the base intervention. +#' +#' @return A data frame summarizing the total cases, cases in very high-risk (VHR) groups, and total cases for each age group and outcome, for both the base and other interventions. +#' +#' @import dplyr +#' @import purrr #' @export compare_interventions <- function(obj_base, obj_inter) { @@ -79,4 +106,57 @@ compare_interventions <- function(obj_base, obj_inter) { base_compare <- base_sum %>% bind_rows(base_sum1) base_compare +} + + + +#' Summarise Outcomes +#' +#' This function takes an object `x` and summarises the outcomes by grouping +#' by `s`, `outcome`, and `age_group`, then calculates the total number of cases. +#' +#' @param x An object containing the outcomes data. +#' @return A data frame with the total number of cases grouped by `s`, `outcome`, and `age_group`. +#' @import dplyr +#' @export +summarise_outcomes <- function(x) { + x@outcomes$outcomes %>% group_by(s, outcome, age_group) %>% summarise(cases_total = sum(cases) ) +} + + +#' @title Calculate Averted Cases Data Frame +#' @description This function calculates the number of averted cases for different interventions compared to a base scenario. +#' @param base A data frame containing the base scenario data with columns `s`, `outcome`, `age_group`, and `cases_total`. +#' @param interventions A data frame containing the intervention scenario data with columns `s`, `outcome`, `age_group`, and `cases_total`. +#' @return A data frame with the calculated averted cases and proportions, with recoded age groups and outcomes. +#' @details The function performs the following steps: +#' \itemize{ +#' \item Joins the base and intervention data frames on `s`, `outcome`, and `age_group`. +#' \item Calculates the total number of cases averted and the proportion of cases averted. +#' \item Recodes the age groups and outcomes to more descriptive labels. +#' \item Converts the recoded age groups and outcomes to factors with specific levels. +#' } +#' @examples +#' \dontrun{ +#' base <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(100, 200, 150, 120, 130)) +#' interventions <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(90, 180, 140, 110, 120)) +#' get_averted_df(base, interventions) +#' } +#' @import dplyr +#' @export +get_averted_df <- function(base, interventions) { + recode_age <- c("1" = "<1 month", "2" = "1 month", "3" = "2 month", "4" = "3 month", "5" = "4 month", + "6" = "5 month", "7" = "6 month", "8" = "7 month", "9" = "8 month", "10" = "9 month", "11" = "10 month", + "12" = "11 month", "13" = "1 year", "14" = "2 year", "15" = "3 years", "16" = "4 years", + "17" = "5-9 years", "18" = "10-14 years", "19" = "15-24 years", "20" = "25-34 years", "21" = "35-44 years", + "22" = "45-54 years", "23" = "55-64 years", "24" = "65-74 years", "25" = "75+ years") + relabel_outcomes <- c("symptomatic" = "Symptomatic cases", "gp" = "GP consultations", + "hosp" = "Hospital cases", "icu" = "ICU admissions", "a_e" = "A+E visits", "death" = "Deaths") + RSV_impact <- interventions %>% + left_join(base %>% rename(case_total_base = cases_total), by = c("s", "outcome", "age_group")) %>% + mutate(total_case_averted = case_total_base - cases_total) %>% mutate(prop_cases_averted = (case_total_base - cases_total) / case_total_base) %>% mutate(age_group = recode(age_group, !!!recode_age)) %>% + mutate(age_group = factor(age_group, levels = unique(recode_age))) %>% + mutate(outcome = recode(outcome, !!!relabel_outcomes)) %>% + mutate(outcome = factor(outcome, levels = unique(relabel_outcomes))) + RSV_impact } \ No newline at end of file diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ + diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..84f0dee --- /dev/null +++ b/docs/404.html @@ -0,0 +1,111 @@ + + + + + + + +Page not found (404) • rsvie + + + + + + + + + + + +
+
+ + + + +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ +
+

+

Site built with pkgdown 2.1.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html new file mode 100644 index 0000000..b65c396 --- /dev/null +++ b/docs/LICENSE.html @@ -0,0 +1,279 @@ + +GNU General Public License • rsvie + + +
+
+ + + +
+
+ + +
+ +

Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

+

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

+
+

Preamble

+

The GNU General Public License is a free, copyleft license for software and other kinds of works.

+

The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program–to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.

+

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.

+

To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.

+

For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

+

Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.

+

For the developers’ and authors’ protection, the GPL clearly explains that there is no warranty for this free software. For both users’ and authors’ sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.

+

Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users’ freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.

+

Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.

+

The precise terms and conditions for copying, distribution and modification follow.

+
+
+

TERMS AND CONDITIONS

+
+

0. Definitions

+

“This License” refers to version 3 of the GNU General Public License.

+

“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.

+

“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.

+

To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.

+

A “covered work” means either the unmodified Program or a work based on the Program.

+

To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.

+

To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.

+

An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

+
+
+

1. Source Code

+

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

+

A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.

+

The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

+

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work’s System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.

+

The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.

+

The Corresponding Source for a work in source code form is that same work.

+
+
+

2. Basic Permissions

+

All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.

+

You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.

+

Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

+
+
+ +

No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.

+

When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work’s users, your or third parties’ legal rights to forbid circumvention of technological measures.

+
+
+

4. Conveying Verbatim Copies

+

You may convey verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.

+

You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.

+
+
+

5. Conveying Modified Source Versions

+

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

+
  • +a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
  • +
  • +b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
  • +
  • +c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
  • +
  • +d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
  • +

A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation’s users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.

+
+
+

6. Conveying Non-Source Forms

+

You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:

+
  • +a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
  • +
  • +b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
  • +
  • +c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
  • +
  • +d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
  • +
  • +e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
  • +

A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.

+

A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.

+

“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.

+

If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).

+

The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.

+

Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.

+
+
+

7. Additional Terms

+

“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.

+

When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.

+

Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:

+
  • +a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
  • +
  • +b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
  • +
  • +c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
  • +
  • +d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
  • +
  • +e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
  • +
  • +f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
  • +

All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.

+

If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.

+

Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.

+
+
+

8. Termination

+

You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).

+

However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

+

Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

+

Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.

+
+
+

9. Acceptance Not Required for Having Copies

+

You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.

+
+
+

10. Automatic Licensing of Downstream Recipients

+

Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.

+

An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party’s predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.

+

You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.

+
+
+

11. Patents

+

A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor’s “contributor version”.

+

A contributor’s “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.

+

Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor’s essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.

+

In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.

+

If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient’s use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.

+

If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.

+

A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.

+

Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.

+
+
+

12. No Surrender of Others’ Freedom

+

If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.

+
+
+

13. Use with the GNU Affero General Public License

+

Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.

+
+
+

14. Revised Versions of this License

+

The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

+

Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

+

If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Program.

+

Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.

+
+
+

15. Disclaimer of Warranty

+

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

+
+
+

16. Limitation of Liability

+

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

+
+
+

17. Interpretation of Sections 15 and 16

+

If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.

+

END OF TERMS AND CONDITIONS

+
+
+
+

How to Apply These Terms to Your New Programs

+

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

+

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

+
<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year>  <name of author>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+

Also add information on how to contact you by electronic and paper mail.

+

If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:

+
<program>  Copyright (C) <year>  <name of author>
+This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type 'show c' for details.
+

The hypothetical commands show w and show c should show the appropriate parts of the General Public License. Of course, your program’s commands might be different; for a GUI interface, you would use an “about box”.

+

You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.

+

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

+
+
+ +
+ + + +
+ + + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/docs/articles/example_mab.html b/docs/articles/example_mab.html new file mode 100644 index 0000000..0d7dc43 --- /dev/null +++ b/docs/articles/example_mab.html @@ -0,0 +1,176 @@ + + + + + + + +Evaluating RSV monoclonal antibody programmes • rsvie + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

Markdown explaining how to use the RSV impact evaluation +rsvie package +

+

## 1. Load package and functions This vignette explains how to use +the rsvie package to evaluate the impact of different RSV +intervention programmes. The package is designed to be flexible and +allow the user to define different intervention programmes, with +different immunological profiles, and evaluate their impact on RSV +outcomes.

+
##  Loading rsvie
+## Creating a new generic function for 'run' in package 'rsvie'
+

Let’s have a more detailed look at what’s in these slots. I wouldn’t +recommend changing them, but future package iterations should allow for +more flexibility.

+
+

2. Add estimate pre-vaccination burden and risks of the +programme +

+

With this empty class, we now add information on the economics of the +model. This includes the health outcomes considered, the risk of each +health outcome occurring per infection, and the QALY loss and cost of +each outcome. First, we define the risk of each health outcome per age +group:

+
## Loading required package: EnvStats
+
## 
+## Attaching package: 'EnvStats'
+
## The following objects are masked from 'package:stats':
+## 
+##     predict, predict.lm
+
+
+

3. Add in immunology +

+

Now, we need to load the QALY loss and cost for each outcome per age +group.

+
+
+

4. Add intervention programmes +

+

With the economics and risks defined, we can now define an +intervention programme. We have several vignettes showing how to +evaluate various types of programmes that use different products. Here +is a simple example:

+
+
+

5. Simulate the intervention programme +

+

To simulate a programme, we call rsvie::run on the class +defined above. This will simulate the programme and return a class with +the results.

+
+
+

6. Extract incidence for further exploration +

+
+
+
+ + + +
+ + + +
+ +
+

+

Site built with pkgdown 2.1.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/articles/example_mat.html b/docs/articles/example_mat.html new file mode 100644 index 0000000..b99c551 --- /dev/null +++ b/docs/articles/example_mat.html @@ -0,0 +1,176 @@ + + + + + + + +Evaluating RSV maternal vaccination programmes • rsvie + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

Markdown explaining how to use the RSV impact evaluation +rsvie package +

+

## 1. Load package and functions This vignette explains how to use +the rsvie package to evaluate the impact of different RSV +intervention programmes. The package is designed to be flexible and +allow the user to define different intervention programmes, with +different immunological profiles, and evaluate their impact on RSV +outcomes.

+
##  Loading rsvie
+## Creating a new generic function for 'run' in package 'rsvie'
+

Let’s have a more detailed look at what’s in these slots. I wouldn’t +recommend changing them, but future package iterations should allow for +more flexibility.

+
+

2. Add estimate pre-vaccination burden and risks of the +programme +

+

With this empty class, we now add information on the economics of the +model. This includes the health outcomes considered, the risk of each +health outcome occurring per infection, and the QALY loss and cost of +each outcome. First, we define the risk of each health outcome per age +group:

+
## Loading required package: EnvStats
+
## 
+## Attaching package: 'EnvStats'
+
## The following objects are masked from 'package:stats':
+## 
+##     predict, predict.lm
+
+
+

3. Add in immunology +

+

Now, we need to load the QALY loss and cost for each outcome per age +group.

+
+
+

4. Add intervention programmes +

+

With the economics and risks defined, we can now define an +intervention programme. We have several vignettes showing how to +evaluate various types of programmes that use different products. Here +is a simple example:

+
+
+

5. Simulate the intervention programme +

+

To simulate a programme, we call rsvie::run on the class +defined above. This will simulate the programme and return a class with +the results.

+
+
+

6. Extract incidence for further exploration +

+
+
+
+ + + +
+ + + +
+ +
+

+

Site built with pkgdown 2.1.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/articles/example_oa.html b/docs/articles/example_oa.html new file mode 100644 index 0000000..f76fcbb --- /dev/null +++ b/docs/articles/example_oa.html @@ -0,0 +1,182 @@ + + + + + + + +Evaluating RSV older adult vaccination programmes • rsvie + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

Markdown explaining how to use the RSV impact evaluation +rsvie package +

+

## 1. Load package and functions This vignette explains how to use +the rsvie package to evaluate the impact of different RSV +intervention programmes. The package is designed to be flexible and +allow the user to define different intervention programmes, with +different immunological profiles, and evaluate their impact on RSV +outcomes.

+
##  Loading rsvie
+## Creating a new generic function for 'run' in package 'rsvie'
+

Let’s have a more detailed look at what’s in these slots. I wouldn’t +recommend changing them, but future package iterations should allow for +more flexibility.

+
+

2. Add estimate pre-vaccination burden and risks of the +programme +

+

With this empty class, we now add information on the economics of the +model. This includes the health outcomes considered, the risk of each +health outcome occurring per infection, and the QALY loss and cost of +each outcome. First, we define the risk of each health outcome per age +group:

+
## Loading required package: EnvStats
+
## 
+## Attaching package: 'EnvStats'
+
## The following objects are masked from 'package:stats':
+## 
+##     predict, predict.lm
+
+
+

3. Add in immunology +

+

Now, we need to load the QALY loss and cost for each outcome per age +group.

+
+
+

4. Add intervention programmes +

+

With the economics and risks defined, we can now define an +intervention programme. We have several vignettes showing how to +evaluate various types of programmes that use different products. Here +is a simple example:

+
## Warning in read.table(system.file(package = "rsvie", "extdata", "uptakes_uk", :
+## incomplete final line found by readTableHeader on '/Users/lshdh2/Dropbox/Mac
+## (3)/Documents/research/rsv/packages/rsvie/inst/extdata/uptakes_uk/flu_oa.csv'
+## Warning in read.table(system.file(package = "rsvie", "extdata", "uptakes_uk", :
+## incomplete final line found by readTableHeader on '/Users/lshdh2/Dropbox/Mac
+## (3)/Documents/research/rsv/packages/rsvie/inst/extdata/uptakes_uk/flu_oa.csv'
+
+
+

5. Simulate the intervention programme +

+

To simulate a programme, we call rsvie::run on the class +defined above. This will simulate the programme and return a class with +the results.

+
+
+

6. Extract incidence for further exploration +

+
+
+
+ + + +
+ + + +
+ +
+

+

Site built with pkgdown 2.1.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/articles/index.html b/docs/articles/index.html new file mode 100644 index 0000000..3a64db9 --- /dev/null +++ b/docs/articles/index.html @@ -0,0 +1,87 @@ + +Articles • rsvie + + +
+
+ + + +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/docs/authors.html b/docs/authors.html new file mode 100644 index 0000000..4a957f1 --- /dev/null +++ b/docs/authors.html @@ -0,0 +1,104 @@ + +Authors and Citation • rsvie + + +
+
+ + + +
+
+
+ + + +
  • +

    David Hodgson. Author, maintainer. +

    +
  • +
+
+
+

Citation

+ +
+
+ + +

Hodgson D (2024). +rsvie: A package for RSV Intervention Evaluations. +R package version 0.0.0.9000. +

+
@Manual{,
+  title = {rsvie: A package for RSV Intervention Evaluations},
+  author = {David Hodgson},
+  year = {2024},
+  note = {R package version 0.0.0.9000},
+}
+ +
+ +
+ + + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 0000000..5a85941 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 0000000..1cdd573 --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/docsearch.css b/docs/docsearch.css new file mode 100644 index 0000000..e5f1fe1 --- /dev/null +++ b/docs/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/docsearch.js b/docs/docsearch.js new file mode 100644 index 0000000..b35504c --- /dev/null +++ b/docs/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..97ac12e --- /dev/null +++ b/docs/index.html @@ -0,0 +1,158 @@ + + + + + + + +A package for RSV Intervention Evaluations • rsvie + + + + + + + + + + + + +
    +
    + + + + +
    +
    +
    + +

    rsvie is a simulation package which allows users to evaluate the impact and cost-effectiveness of potential RSV intervention programmes in England and Wales. The user can define intervention program timings, products, risk of outcomes, costs, and QALYs.

    +
    +

    Installation +

    +

    First, install R.

    +

    Then, install the development version of ‘rsvie’ by running the following commands in R.

    +
    # install.package("devtools") only run if devtools isn't installed.
    +library(devtools)
    +github_install("dchodge/rsvie")
    +library(rsvie)
    +
    +
    +

    Quick start and overview of the package +

    +

    The user must define several components in order to simulate the impact of an RSV intervention programme. These are 1. add_economics, the user must define the health outcomes considered, the risk of each health outcome occurring per-infection, and the QALY loss and cost of each outcome. 2. add_programme, the user must define the programme characteristics they wish to evaluate, including the timings (start date and end date), the target age group, the product’s immunological profile, and the uptake rate.

    +

    A detailed vignette explaining defining these characteristics can be found in vignettes/example.Rmd.

    +
    +
    +

    Example vignettes +

    +

    We also include several vignettes showing how to evaluate various programmes. These are found in vignettes/sanity_check_*.

    +
    +
    +

    Contact +

    +

    If you have any questions, please email me at

    +
    +
    +
    + + +
    + + +
    + +
    +

    +

    Site built with pkgdown 2.1.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/link.svg b/docs/link.svg new file mode 100644 index 0000000..88ad827 --- /dev/null +++ b/docs/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css new file mode 100644 index 0000000..80ea5b8 --- /dev/null +++ b/docs/pkgdown.css @@ -0,0 +1,384 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body { + position: relative; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +/* Ensure in-page images don't run outside their container */ +.contents img { + max-width: 100%; + height: auto; +} + +/* Fix bug in bootstrap (only seen in firefox) */ +summary { + display: list-item; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents .page-header { + margin-top: calc(-60px + 1em); +} + +dd { + margin-left: 3em; +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + display: none; + margin-left: 5px; + width: 20px; + height: 20px; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-block; +} + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} + +/* Sidebar --------------------------*/ + +#pkgdown-sidebar { + margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; +} + +#pkgdown-sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#pkgdown-sidebar h2:first-child { + margin-top: 0; +} + +#pkgdown-sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + +.orcid { + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top; min-width: 100px} +.ref-index .icon {width: 40px;} +.ref-index .alias {width: 40%;} +.ref-index-icons .alias {width: calc(40% - 40px);} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre, code, pre code { + background-color: #f8f8f8; + color: #333; +} +pre, pre code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; +} + +pre { + border: 1px solid #eee; +} + +pre .img, pre .r-plt { + margin: 5px 0; +} + +pre .img img, pre .r-plt img { + background-color: #fff; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.error {font-weight: bolder;} +.warning {font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} + +/* Section anchors --------------------------------- + Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 +*/ + +div.csl-bib-body { } +div.csl-entry { + clear: both; +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js new file mode 100644 index 0000000..6f0eee4 --- /dev/null +++ b/docs/pkgdown.js @@ -0,0 +1,108 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $('.navbar-fixed-top').headroom(); + + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $("div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml new file mode 100644 index 0000000..37f6927 --- /dev/null +++ b/docs/pkgdown.yml @@ -0,0 +1,8 @@ +pandoc: '3.5' +pkgdown: 2.1.1 +pkgdown_sha: ~ +articles: + example_mab: example_mab.html + example_mat: example_mat.html + example_oa: example_oa.html +last_built: 2024-12-09T09:50Z diff --git a/docs/reference/RSVProgramme-class.html b/docs/reference/RSVProgramme-class.html new file mode 100644 index 0000000..c885164 --- /dev/null +++ b/docs/reference/RSVProgramme-class.html @@ -0,0 +1,192 @@ + +RSVProgramme Class — RSVProgramme-class • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    A class to represent an RSV (Respiratory Syncytial Virus) Programme.

    +
    + + +
    +

    Slots

    + + +
    econ_name
    +

    A character string representing the economic name.

    + + +
    prog_name
    +

    A character string representing the programme name.

    + + +
    model
    +

    An object of class refClass representing the model.

    + + +
    uk_data
    +

    A list containing UK data.

    + + +
    model_par
    +

    A list of model parameters.

    + + +
    econ_par
    +

    A list of economic parameters.

    + + +
    model_calendar
    +

    A list representing the model calendar.

    + + +
    dose_calendar
    +

    A list representing the dose calendar.

    + + +
    immune_profile
    +

    A list representing the immune profile.

    + + +
    econ_df
    +

    A data.frame containing economic data.

    + + +
    risks_df
    +

    A data.frame containing risk data.

    + + +
    risks_vhr_df
    +

    A data.frame containing very high risk data.

    + + +
    outcomes_vec
    +

    A vector of outcomes.

    + + +
    post
    +

    A data.frame containing posterior data.

    + + +
    seeds
    +

    A vector of seeds.

    + + +
    S
    +

    A numeric value.

    + + +
    raw_inci
    +

    A list of raw incidence data.

    + + +
    wane_func_string
    +

    A character string representing the waning function.

    + + +
    wane_func_string_vhr
    +

    A character string representing the waning function for very high risk.

    + + +
    outcomes
    +

    A list of outcomes.

    + + +
    samples_outcomes
    +

    A list of sample outcomes.

    + + +
    samples_outcomes_VHR
    +

    A list of sample outcomes for very high risk.

    + + +
    efficacies
    +

    A vector of efficacies.

    + + +
    cov_mat
    +

    A numeric matrix representing the covariance matrix.

    + + +
    full_output
    +

    A logical value indicating whether to produce full output.

    + + +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/add_economics-RSVProgramme-method.html b/docs/reference/add_economics-RSVProgramme-method.html new file mode 100644 index 0000000..8163fb9 --- /dev/null +++ b/docs/reference/add_economics-RSVProgramme-method.html @@ -0,0 +1,135 @@ + +Add Economics Data to RSVProgramme Object — add_economics,RSVProgramme-method • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This method adds economic data to an RSVProgramme object.

    +
    + +
    +
    # S4 method for class 'RSVProgramme'
    +add_economics(object, econ_name, econ_raw, risks_raw, risks_vhr_raw)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object of class RSVProgramme.

    + + +
    econ_name
    +

    A character string representing the name of the economic data.

    + + +
    econ_raw
    +

    A data frame containing the raw economic data.

    + + +
    risks_raw
    +

    A data frame containing the raw risks data.

    + + +
    risks_vhr_raw
    +

    A data frame containing the raw very high risk (VHR) data.

    + +
    +
    +

    Value

    +

    The updated RSVProgramme object with the added economic data.

    +
    +
    +

    Details

    +

    This method performs the following steps:

    • Checks if the output directory for the economic data exists, and creates it if it does not.

    • +
    • Assigns the provided economic data and risk data to the corresponding slots in the RSVProgramme object.

    • +
    • Extracts unique outcomes from the economic data and assigns them to the outcomes_vec slot.

    • +
    • Stops execution if no outcomes are detected in the economic data.

    • +
    • Generates samples of outcomes and assigns them to the samples_outcomes and samples_outcomes_VHR slots.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  rsv_programme <- new("RSVProgramme")
    +  rsv_programme <- add_economics(rsv_programme, "econ_data", econ_raw_df, risks_raw_df, risks_vhr_raw_df)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/add_economics.html b/docs/reference/add_economics.html new file mode 100644 index 0000000..27f0c31 --- /dev/null +++ b/docs/reference/add_economics.html @@ -0,0 +1,118 @@ + +Add Economics Data to an Object — add_economics • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This generic function is used to add economics data to a specified object.

    +
    + +
    +
    add_economics(object, econ_name, econ_raw, risks_raw, risks_vhr_raw)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    The object to which the economics data will be added.

    + + +
    econ_name
    +

    A character string representing the name of the economics data.

    + + +
    econ_raw
    +

    The raw economics data to be added.

    + + +
    risks_raw
    +

    The raw risks data associated with the economics data.

    + + +
    risks_vhr_raw
    +

    The raw very high risk data associated with the economics data.

    + +
    +
    +

    Value

    +

    The object with the added economics data.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/add_fitted_dist.html b/docs/reference/add_fitted_dist.html new file mode 100644 index 0000000..2c5648a --- /dev/null +++ b/docs/reference/add_fitted_dist.html @@ -0,0 +1,115 @@ + +Add Fitted Distribution to Data Frame — add_fitted_dist • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function fits a specified distribution to the data in a given data frame and adds the fitted distribution as a new column.

    +
    + +
    +
    add_fitted_dist(cost_df, dist)
    +
    + +
    +

    Arguments

    + + +
    cost_df
    +

    A data frame containing the data to which the distribution will be fitted. The data frame should have columns named "mean", "lb_95", and "ub_95".

    + + +
    dist
    +

    A character string specifying the distribution to fit. The distribution should be one of the distributions supported by the q function in R (e.g., "norm" for normal distribution, "tri" for triangular distribution).

    + +
    +
    +

    Value

    +

    A data frame with an additional column named fitt_dist containing the fitted distribution for each row.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +cost_df <- data.frame(mean = c(10, 20), lb_95 = c(5, 15), ub_95 = c(15, 25))
    +add_fitted_dist(cost_df, "norm")
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/add_programme-RSVProgramme-method.html b/docs/reference/add_programme-RSVProgramme-method.html new file mode 100644 index 0000000..e811c74 --- /dev/null +++ b/docs/reference/add_programme-RSVProgramme-method.html @@ -0,0 +1,123 @@ + +Add Programme to RSVProgramme Object — add_programme,RSVProgramme-method • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This method adds a programme to an RSVProgramme object, setting various attributes and creating necessary directories.

    +
    + +
    +
    # S4 method for class 'RSVProgramme'
    +add_programme(object, prog_name, cal, cal_vhr, immune_profile)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object of class RSVProgramme.

    + + +
    prog_name
    +

    A character string representing the name of the programme.

    + + +
    cal
    +

    A calendar object used for the programme.

    + + +
    cal_vhr
    +

    A calendar object for very high-risk (VHR) groups.

    + + +
    immune_profile
    +

    A list containing the immune profile information.

    + +
    +
    +

    Value

    +

    The updated RSVProgramme object with the new programme added.

    +
    +
    +

    Details

    +

    This function sets the programme name, checks and creates necessary directories, initializes dose and sero matrices, calculates daily uptake, converts matrices to transmission calendars, and sets various attributes in the RSVProgramme object.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/add_programme.html b/docs/reference/add_programme.html new file mode 100644 index 0000000..fa2a618 --- /dev/null +++ b/docs/reference/add_programme.html @@ -0,0 +1,118 @@ + +Add Programme — add_programme • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function is a generic method for adding a programme to an object.

    +
    + +
    +
    add_programme(object, prog_name, cal, cal_vhr, immune_profile)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    The object to which the programme will be added.

    + + +
    prog_name
    +

    The name of the programme to be added.

    + + +
    cal
    +

    The calendar associated with the programme.

    + + +
    cal_vhr
    +

    The calendar with very high resolution associated with the programme.

    + + +
    immune_profile
    +

    The immune profile associated with the programme.

    + +
    +
    +

    Value

    +

    The object with the added programme.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/calculate_daily_uptake.html b/docs/reference/calculate_daily_uptake.html new file mode 100644 index 0000000..50b3f48 --- /dev/null +++ b/docs/reference/calculate_daily_uptake.html @@ -0,0 +1,120 @@ + +Calculate Daily Uptake — calculate_daily_uptake • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function calculates the daily uptake for different age groups based on the provided calibration data frame.

    +
    + +
    +
    calculate_daily_uptake(object, cal_df)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing the UK data with age group boundaries.

    + + +
    cal_df
    +

    A data frame containing the start and end dates, and uptake types for each age group.

    + +
    +
    +

    Value

    +

    A matrix with 365 rows (days) and 25 columns (age groups) representing the daily uptake.

    +
    +
    +

    Details

    +

    The function processes each age group, calculates the start and end positions within the year, and fills the uptake matrix accordingly. +Different uptake types such as "linear", "birth_rate", "flu_oa", and "oa_2425" are handled.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +object <- your_object_with_uk_data
    +cal_df <- your_calibration_data_frame
    +daily_uptake_matrix <- calculate_daily_uptake(object, cal_df)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/checkout_incidence.html b/docs/reference/checkout_incidence.html new file mode 100644 index 0000000..82d65a6 --- /dev/null +++ b/docs/reference/checkout_incidence.html @@ -0,0 +1,114 @@ + +function to conver the incidence matrix from a run to a data.frame — checkout_incidence • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function processes the incidence data from an object.

    +
    + +
    +
    checkout_incidence(object, rerun = FALSE)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing the raw incidence data.

    + + +
    rerun
    +

    A logical value indicating whether to rerun the rsvie::run function on the object. Default is TRUE.

    + +
    +
    +

    Value

    +

    none

    +

    A data frame containing the processed incidence data with additional columns for time, age group, social group, and risk group.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  result <- checkout_incidence(my_object)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/checkout_states.html b/docs/reference/checkout_states.html new file mode 100644 index 0000000..0325c5b --- /dev/null +++ b/docs/reference/checkout_states.html @@ -0,0 +1,106 @@ + +Checkout States — checkout_states • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function processes the states of a given object and returns a data table with detailed information about each state.

    +
    + +
    +
    checkout_states(object)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing the states to be processed.

    + +
    +
    +

    Value

    +

    A data table with columns for time, incidence, age group, risk group, social group, model type, and state name.

    +
    +
    +

    Details

    +

    The function generates a list of state names and categorizes them into risk groups, social groups, and model types. It then runs the state function on the input object and processes the resulting states into a data frame. The data frame is then transformed into a long format and additional columns are added to provide detailed information about each state.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/compare_interventions.html b/docs/reference/compare_interventions.html new file mode 100644 index 0000000..7eed23a --- /dev/null +++ b/docs/reference/compare_interventions.html @@ -0,0 +1,106 @@ + +Compare Interventions — compare_interventions • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function compares the outcomes of a base intervention with multiple other interventions.

    +
    + +
    +
    compare_interventions(obj_base, obj_inter)
    +
    + +
    +

    Arguments

    + + +
    obj_base
    +

    An object containing the outcomes of the base intervention.

    + + +
    obj_inter
    +

    A list of objects, each containing the outcomes of different interventions to be compared with the base intervention.

    + +
    +
    +

    Value

    +

    A data frame summarizing the total cases, cases in very high-risk (VHR) groups, and total cases for each age group and outcome, for both the base and other interventions.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/convert_efficacies.html b/docs/reference/convert_efficacies.html new file mode 100644 index 0000000..4a2a879 --- /dev/null +++ b/docs/reference/convert_efficacies.html @@ -0,0 +1,147 @@ + +Convert Immune Profile to Efficacies — convert_efficacies • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function takes an immune profile and converts it into a list of efficacies for different products.

    +
    + +
    +
    convert_efficacies(immune_profile)
    +
    + +
    +

    Arguments

    + + +
    immune_profile
    +

    A list containing immune profile information. It should have the following structure:

    vhr
    +

    A list with element b representing the efficacy for very high risk (VHR) individuals.

    + +
    mass
    +

    A list with elements b and product representing the efficacy and product type for mass immunization. The product can be "lav", "mab", or "mat".

    + + +
    + +
    +
    +

    Value

    +

    A list with the following elements:

    mab_vhr
    +

    Efficacy for monoclonal antibodies (MAB) in very high risk individuals.

    + +
    mab_mass
    +

    Efficacy for monoclonal antibodies (MAB) in mass immunization.

    + +
    lav_mass
    +

    Efficacy for live attenuated vaccines (LAV) in mass immunization.

    + +
    mat_mass
    +

    Efficacy for maternal antibodies (MAT) in mass immunization.

    + + +
    +
    +

    Details

    +

    The function initializes the efficacy list with zeros. It then checks if the immune profile contains efficacy values for VHR and mass immunization and updates the efficacy list accordingly.

    +
    + +
    +

    Examples

    +
    immune_profile <- list(
    +  vhr = list(b = 0.8),
    +  mass = list(b = 0.6, product = "lav")
    +)
    +convert_efficacies(immune_profile)
    +#> $mab_vhr
    +#> [1] 0.8
    +#> 
    +#> $mab_mass
    +#> [1] 0
    +#> 
    +#> $lav_mass
    +#> [1] 0.6
    +#> 
    +#> $mat_mass
    +#> [1] 0
    +#> 
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/convert_mat_to_trans_cal.html b/docs/reference/convert_mat_to_trans_cal.html new file mode 100644 index 0000000..1db0565 --- /dev/null +++ b/docs/reference/convert_mat_to_trans_cal.html @@ -0,0 +1,139 @@ + +Convert Matrices to Transmission Calendar — convert_mat_to_trans_cal • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function converts dose and sero matrices into a transmission calendar based on the provided immune profile.

    +
    + +
    +
    convert_mat_to_trans_cal(
    +  all_dose,
    +  all_sero,
    +  cal_vhr,
    +  daily_uptake_vhr,
    +  cal,
    +  daily_uptake,
    +  immune_profile
    +)
    +
    + +
    +

    Arguments

    + + +
    all_dose
    +

    A matrix representing all doses.

    + + +
    all_sero
    +

    A matrix representing all sero values.

    + + +
    cal_vhr
    +

    A calendar matrix for very high risk (VHR) individuals.

    + + +
    daily_uptake_vhr
    +

    A matrix representing daily uptake for VHR individuals.

    + + +
    cal
    +

    A calendar matrix for the general population.

    + + +
    daily_uptake
    +

    A matrix representing daily uptake for the general population.

    + + +
    immune_profile
    +

    A list containing immune profiles for VHR and general population.

    + +
    +
    +

    Value

    +

    A list containing updated dose and sero matrices.

    +
    +
    +

    Details

    +

    The function first creates a VHR calendar if the immune profile for VHR is not "none". It then calculates the sero and dose models using the get_sero_dose_cals helper function. The results are stored in the all_sero and all_dose matrices.

    +

    The get_sero_dose_cals function calculates the dose and sero models based on the provided calendar, daily uptake, and immune profile. It considers different sero delays and coverage values.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/convert_to_outcomes.html b/docs/reference/convert_to_outcomes.html new file mode 100644 index 0000000..b2ed788 --- /dev/null +++ b/docs/reference/convert_to_outcomes.html @@ -0,0 +1,134 @@ + +Convert to Outcomes — convert_to_outcomes • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function processes an object to calculate various health outcomes over time.

    +
    + +
    +
    convert_to_outcomes(object, yrsum = 2)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing the necessary data for processing.

    + + +
    yrsum
    +

    An integer specifying the number of years to summarize. Default is 2.

    + +
    +
    +

    Value

    +

    A list containing the following elements:

    +
    outcomes
    +

    A data frame with weekly outcomes by age group.

    + +
    costs
    +

    A data frame with discounted costs by outcome and age group.

    + +
    qaly
    +

    A data frame with discounted quality-adjusted life years (QALYs) by outcome and age group.

    + +
    doses
    +

    A vector containing the number of doses administered.

    + +
    +
    +

    Details

    +

    The function performs the following steps:

    1. Extracts necessary data from the input object.

    2. +
    3. Calculates the proportion of individuals in different states over time.

    4. +
    5. Estimates the incidence of various health outcomes for vaccinated and unvaccinated groups.

    6. +
    7. Computes the protected incidence for different health outcomes.

    8. +
    9. Aggregates the results to provide weekly outcomes, costs, and QALYs by age group.

    10. +
    11. Applies discounting to costs and QALYs.

    12. +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +result <- convert_to_outcomes(my_object, yrsum = 3)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/covert_raw_to_risk.html b/docs/reference/covert_raw_to_risk.html new file mode 100644 index 0000000..cae58a9 --- /dev/null +++ b/docs/reference/covert_raw_to_risk.html @@ -0,0 +1,127 @@ + +Convert Raw Outcomes to Risk — covert_raw_to_risk • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function converts raw outcome data to risk metrics based on population data and model cases sample mean.

    +
    + +
    +
    covert_raw_to_risk(object, outcomes_raw, model_cases_sample_mean)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing UK population data.

    + + +
    outcomes_raw
    +

    A data frame containing raw outcome data.

    + + +
    model_cases_sample_mean
    +

    A data frame containing model cases sample mean.

    + +
    +
    +

    Value

    +

    A data frame with calculated risk metrics for each age group and outcome.

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Extracts population and age group data from the input object.

    • +
    • Defines helper functions to check the completeness of data and calculate risk per infection.

    • +
    • Checks that each outcome has data for all age groups.

    • +
    • Combines raw outcomes data with model cases data and population data.

    • +
    • Calculates the risk per infection for each outcome and age group.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  result <- covert_raw_to_risk(object, outcomes_raw, model_cases_sample_mean)
    +  print(result)
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/get_averted_df.html b/docs/reference/get_averted_df.html new file mode 100644 index 0000000..30baeee --- /dev/null +++ b/docs/reference/get_averted_df.html @@ -0,0 +1,122 @@ + +Calculate Averted Cases Data Frame — get_averted_df • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function calculates the number of averted cases for different interventions compared to a base scenario.

    +
    + +
    +
    get_averted_df(base, interventions)
    +
    + +
    +

    Arguments

    + + +
    base
    +

    A data frame containing the base scenario data with columns s, outcome, age_group, and cases_total.

    + + +
    interventions
    +

    A data frame containing the intervention scenario data with columns s, outcome, age_group, and cases_total.

    + +
    +
    +

    Value

    +

    A data frame with the calculated averted cases and proportions, with recoded age groups and outcomes.

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Joins the base and intervention data frames on s, outcome, and age_group.

    • +
    • Calculates the total number of cases averted and the proportion of cases averted.

    • +
    • Recodes the age groups and outcomes to more descriptive labels.

    • +
    • Converts the recoded age groups and outcomes to factors with specific levels.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +base <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(100, 200, 150, 120, 130))
    +interventions <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(90, 180, 140, 110, 120))
    +get_averted_df(base, interventions)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/get_coverage.html b/docs/reference/get_coverage.html new file mode 100644 index 0000000..2078564 --- /dev/null +++ b/docs/reference/get_coverage.html @@ -0,0 +1,114 @@ + +Get Coverage — get_coverage • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function calculates the coverage based on the immune profile mass and calibration data.

    +
    + +
    +
    get_coverage(immune_profile_mass, cal)
    +
    + +
    +

    Arguments

    + + +
    immune_profile_mass
    +

    A data frame containing the immune profile mass information.

    + + +
    cal
    +

    A data frame containing the calibration data.

    + +
    +
    +

    Value

    +

    The coverage value. If the product in the immune profile mass is "mat", it returns the mean of the positive coverage values from the calibration data. Otherwise, it returns 0.

    +
    + +
    +

    Examples

    +
    immune_profile_mass <- data.frame(product = "mat")
    +cal <- data.frame(cov = c(0.1, 0.2, 0, -0.1))
    +get_coverage(immune_profile_mass, cal)
    +#> [1] 0.15
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/get_daily_uptake.html b/docs/reference/get_daily_uptake.html new file mode 100644 index 0000000..bfa1ffa --- /dev/null +++ b/docs/reference/get_daily_uptake.html @@ -0,0 +1,119 @@ + +Calculate Daily Uptake from Weekly Data — get_daily_uptake • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function calculates the daily uptake based on weekly uptake data.

    +
    + +
    +
    get_daily_uptake(up_week_raw, start_time)
    +
    + +
    +

    Arguments

    + + +
    up_week_raw
    +

    A numeric vector containing the weekly uptake data.

    + + +
    start_time
    +

    An integer representing the start time in days.

    + +
    +
    +

    Value

    +

    A numeric vector of length 365 representing the daily uptake.

    +
    +
    +

    Details

    +

    The function first processes the weekly data to fill a weekly uptake vector, then calculates the daily uptake by interpolating the weekly data.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +up_week_raw <- c(0.1, 0.2, 0.3, 0.4, 0.5)
    +start_time <- 1
    +daily_uptake <- get_daily_uptake(up_week_raw, start_time)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/get_efficacies_sample.html b/docs/reference/get_efficacies_sample.html new file mode 100644 index 0000000..4b7e571 --- /dev/null +++ b/docs/reference/get_efficacies_sample.html @@ -0,0 +1,119 @@ + +Get Efficacies Sample — get_efficacies_sample • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function retrieves a sample of efficacies from an object based on a provided seed.

    +
    + +
    +
    get_efficacies_sample(object, seed)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing efficacies in a list format.

    + + +
    seed
    +

    An integer representing the seed to select the sample from the efficacies.

    + +
    +
    +

    Value

    +

    A list containing the sampled efficacies for each efficacy type.

    +
    +
    +

    Details

    +

    The function initializes a list with efficacy types set to 0. It then iterates over the names of the efficacy types and checks if the length of the efficacy values for each type is greater than 1. If so, it selects the efficacy value based on the provided seed. Otherwise, it assigns the single efficacy value to the list. The function finally returns the list of sampled efficacies.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +object <- list(efficacies = list(mab_vhr = c(0.1, 0.2), mab_mass = 0.3, lav_mass = c(0.4, 0.5), mat_mass = 0.6))
    +seed <- 1
    +get_efficacies_sample(object, seed)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html new file mode 100644 index 0000000..84dc9ca --- /dev/null +++ b/docs/reference/index.html @@ -0,0 +1,204 @@ + +Package index • rsvie + + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    All functions

    +

    +
    +

    RSVProgramme-class

    +

    RSVProgramme Class

    +

    add_economics(<RSVProgramme>)

    +

    Add Economics Data to RSVProgramme Object

    +

    add_economics()

    +

    Add Economics Data to an Object

    +

    add_fitted_dist()

    +

    Add Fitted Distribution to Data Frame

    +

    add_programme(<RSVProgramme>)

    +

    Add Programme to RSVProgramme Object

    +

    add_programme()

    +

    Add Programme

    +

    calculate_daily_uptake()

    +

    Calculate Daily Uptake

    +

    checkout_incidence()

    +

    function to conver the incidence matrix from a run to a data.frame

    +

    checkout_states()

    +

    Checkout States

    +

    compare_interventions()

    +

    Compare Interventions

    +

    convert_efficacies()

    +

    Convert Immune Profile to Efficacies

    +

    convert_mat_to_trans_cal()

    +

    Convert Matrices to Transmission Calendar

    +

    convert_to_outcomes()

    +

    Convert to Outcomes

    +

    covert_raw_to_risk()

    +

    Convert Raw Outcomes to Risk

    +

    get_averted_df()

    +

    Calculate Averted Cases Data Frame

    +

    get_coverage()

    +

    Get Coverage

    +

    get_daily_uptake()

    +

    Calculate Daily Uptake from Weekly Data

    +

    get_efficacies_sample()

    +

    Get Efficacies Sample

    +

    make_RunInterventions()

    +

    Initialise the RunInterventions class

    +

    make_rsv_programme()

    +

    A constructor to make an RSVProgramme object

    +

    output_samples()

    +

    Generate and output samples for economic and risk data

    +

    plot_calendar()

    +

    Plot Dosing Calendar

    +

    plot_economics()

    +

    Plot Economics Data

    +

    plot_economics_fit()

    +

    Plot Economic Fit

    +

    plot_outcomes()

    +

    Plot Outcomes

    +

    run(<RSVProgramme>)

    +

    A setMethod for the run function

    +

    run()

    +

    Run Method

    +

    run_state(<RSVProgramme>)

    +

    A setMethod for the run_state function

    +

    run_state()

    +

    Run State Generic Function

    +

    summarise_outcomes()

    +

    Summarise Outcomes

    + + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/make_RunInterventions.html b/docs/reference/make_RunInterventions.html new file mode 100644 index 0000000..2f8462d --- /dev/null +++ b/docs/reference/make_RunInterventions.html @@ -0,0 +1,114 @@ + +Initialise the RunInterventions class — make_RunInterventions • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    Initialise the RunInterventions class

    +
    + +
    +
    make_RunInterventions(RunInterventions, uk_data_sum, run_burn, run_full)
    +
    + +
    +

    Arguments

    + + +
    RunInterventions
    +

    An empty RunInterventions class

    + + +
    uk_data_sum
    +

    an .rda file with all the information needed to fit the UK model

    + + +
    run_burn
    +

    Burn-in for the model (in days)

    + + +
    run_full
    +

    Number of days to run the model for post burn-in

    + +
    +
    +

    Value

    +

    A classRunInterventions which is fully parameterised

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/make_rsv_programme.html b/docs/reference/make_rsv_programme.html new file mode 100644 index 0000000..b5f528c --- /dev/null +++ b/docs/reference/make_rsv_programme.html @@ -0,0 +1,102 @@ + +A constructor to make an RSVProgramme object — make_rsv_programme • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    A constructor to make an RSVProgramme object

    +
    + +
    +
    make_rsv_programme(S = 10)
    +
    + +
    +

    Arguments

    + + +
    S
    +

    an integer taking the number of Monte Carlo samples to run over

    + +
    +
    +

    Value

    +

    A RSVProgramme object

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/output_samples.html b/docs/reference/output_samples.html new file mode 100644 index 0000000..1f5589d --- /dev/null +++ b/docs/reference/output_samples.html @@ -0,0 +1,128 @@ + +Generate and output samples for economic and risk data — output_samples • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function processes raw economic and risk data, fits distributions to the data, +generates samples, and outputs the results to a specified file.

    +
    + +
    +
    output_samples(econ_raw, risks_raw, file.name)
    +
    + +
    +

    Arguments

    + + +
    econ_raw
    +

    A data frame containing raw economic data with columns for age group, outcome, reference QALYs, mean QALYs, lower bound QALYs, and upper bound QALYs.

    + + +
    risks_raw
    +

    A data frame containing raw risk data.

    + + +
    file.name
    +

    A string specifying the name of the output file.

    + +
    +
    +

    Value

    +

    A list containing sampled outcomes for risks, QALYs, and costs.

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Fits triangular distributions to the risk, QALY, and cost data.

    • +
    • Generates samples for each outcome using the fitted distributions.

    • +
    • Outputs the sampled outcomes to the specified file.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +econ_raw <- read.csv("economic_data.csv")
    +risks_raw <- read.csv("risk_data.csv")
    +output_samples(econ_raw, risks_raw, "output_samples.csv")
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/plot_calendar.html b/docs/reference/plot_calendar.html new file mode 100644 index 0000000..3366f04 --- /dev/null +++ b/docs/reference/plot_calendar.html @@ -0,0 +1,118 @@ + +Plot Dosing Calendar — plot_calendar • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function generates and saves a plot of the dosing calendar for different age groups.

    +
    + +
    +
    plot_calendar(object)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing the dosing calendar and other relevant data.

    + +
    +
    +

    Value

    +

    None

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Checks if the directory for saving the plot exists, and creates it if it does not.

    • +
    • Extracts unique age groups from the economic data frame within the object.

    • +
    • Updates the column names of the dose calendar matrices to match the age groups.

    • +
    • Converts the dose calendar matrices into a data frame suitable for plotting.

    • +
    • Generates a ggplot of the dosing calendar, with days of the year on the x-axis, age groups on the y-axis, and the proportion of doses as the fill color.

    • +
    • Saves the plot as a PNG file in the specified directory.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +plot_calendar(my_object)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/plot_economics.html b/docs/reference/plot_economics.html new file mode 100644 index 0000000..0b2436f --- /dev/null +++ b/docs/reference/plot_economics.html @@ -0,0 +1,106 @@ + +Plot Economics Data — plot_economics • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function generates and saves plots for economic data, risks data, and very high-risk data from the given object.

    +
    + +
    +
    plot_economics(object)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object containing economic data frames (econ_df, risks_df, risks_vhr_df) and an economic name (econ_name).

    + +
    +
    +

    Details

    +

    The function performs the following steps:

    • Checks if the directory for saving plots exists, and creates it if it does not.

    • +
    • Processes the economic data frame (econ_df) to create a combined data frame for QALY loss and Costs.

    • +
    • Generates and saves a plot for the economic data with uncertainty ribbons and lines.

    • +
    • Generates and saves a plot for the risks data with uncertainty ribbons and lines.

    • +
    • Generates and saves a plot for the very high-risk data with lines.

    • +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/plot_economics_fit.html b/docs/reference/plot_economics_fit.html new file mode 100644 index 0000000..6c4846a --- /dev/null +++ b/docs/reference/plot_economics_fit.html @@ -0,0 +1,120 @@ + +Plot Economic Fit — plot_economics_fit • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function generates and saves plots comparing fitted distributions to reference data for risks, QALYs, and costs across different age groups.

    +
    + +
    +
    plot_economics_fit(object)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An S4 object containing economic data and model outcomes.

    + +
    +
    +

    Value

    +

    None. The function saves the generated plots to the specified directory.

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Checks if the directory for saving plots exists, and creates it if it doesn't.

    • +
    • Extracts unique age groups from the economic data.

    • +
    • Defines a helper function to extract mean and 95% uncertainty intervals for model outcomes.

    • +
    • Extracts fitted model outcomes for risks, QALYs, and costs.

    • +
    • Prepares data frames for risks, QALYs, and costs by merging reference data with fitted model outcomes.

    • +
    • Defines a helper function to convert data frames to long format for plotting.

    • +
    • Converts the prepared data frames to long format.

    • +
    • Generates and saves plots comparing fitted model outcomes to reference data for risks, QALYs, and costs.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  plot_economics_fit(my_economic_model)
    +} # }
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/plot_outcomes.html b/docs/reference/plot_outcomes.html new file mode 100644 index 0000000..3a277df --- /dev/null +++ b/docs/reference/plot_outcomes.html @@ -0,0 +1,110 @@ + +Plot Outcomes — plot_outcomes • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function loads the run outputs from a specified file, extracts the outcomes data, and creates a boxplot of costs and QALY (Quality-Adjusted Life Year) outcomes. The plot is saved as a PNG file.

    +
    + +
    +
    plot_outcomes(object)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An S4 object that contains the program name and outcomes data.

    + +
    +
    +

    Value

    +

    A ggplot object representing the boxplot of costs and QALY outcomes.

    +
    +
    +

    Details

    +

    The function performs the following steps:

    • Loads the run outputs from a file located in the "outputs" directory.

    • +
    • Extracts the outcomes data from the loaded object.

    • +
    • Binds the costs and QALY data into a single data frame.

    • +
    • Creates a boxplot of the costs and QALY data using ggplot2.

    • +
    • Saves the plot as a PNG file in the "figs" subdirectory of the "outputs" directory.

    • +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/run-RSVProgramme-method.html b/docs/reference/run-RSVProgramme-method.html new file mode 100644 index 0000000..28a122d --- /dev/null +++ b/docs/reference/run-RSVProgramme-method.html @@ -0,0 +1,111 @@ + +A setMethod for the run function — run,RSVProgramme-method • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    A setMethod for the run function

    +
    + +
    +
    # S4 method for class 'RSVProgramme'
    +run(object, direct = FALSE, filename = NULL, yr_num = 2)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    The object on which the operation is performed.

    + + +
    direct
    +

    A logical value indicating whether to run the operation directly.

    + + +
    filename
    +

    An optional character string specifying the filename.

    + + +
    yr_num
    +

    An integer specifying the number of years, default is 2.#' @return An RSVProgramme object

    + +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/run.html b/docs/reference/run.html new file mode 100644 index 0000000..4544331 --- /dev/null +++ b/docs/reference/run.html @@ -0,0 +1,114 @@ + +Run Method — run • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    Generic function to execute a specific operation.

    +
    + +
    +
    run(object, direct = FALSE, filename = NULL, yr_num = 2)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    The object on which the operation is performed.

    + + +
    direct
    +

    A logical value indicating whether to run the operation directly.

    + + +
    filename
    +

    An optional character string specifying the filename.

    + + +
    yr_num
    +

    An integer specifying the number of years, default is 2.

    + +
    +
    +

    Value

    +

    The result of the operation.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/run_state-RSVProgramme-method.html b/docs/reference/run_state-RSVProgramme-method.html new file mode 100644 index 0000000..d317c40 --- /dev/null +++ b/docs/reference/run_state-RSVProgramme-method.html @@ -0,0 +1,111 @@ + +A setMethod for the run_state function — run_state,RSVProgramme-method • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    A setMethod for the run_state function

    +
    + +
    +
    # S4 method for class 'RSVProgramme'
    +run_state(object, S_i = 1, direct = FALSE)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object on which the state is to be run.

    + + +
    S_i
    +

    An integer representing the state index. Default is 1.

    + + +
    direct
    +

    A logical value indicating whether to run the state directly. Default is FALSE.

    + +
    +
    +

    Value

    +

    a matrix with all the values of the state variables in the dynamic transmission model

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/run_state.html b/docs/reference/run_state.html new file mode 100644 index 0000000..20d563e --- /dev/null +++ b/docs/reference/run_state.html @@ -0,0 +1,110 @@ + +Run State Generic Function — run_state • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This is a generic function for running a state.

    +
    + +
    +
    run_state(object, S_i = 1, direct = FALSE)
    +
    + +
    +

    Arguments

    + + +
    object
    +

    An object on which the state is to be run.

    + + +
    S_i
    +

    An integer representing the state index. Default is 1.

    + + +
    direct
    +

    A logical value indicating whether to run the state directly. Default is FALSE.

    + +
    +
    +

    Value

    +

    The result of the state run, depending on the method implementation.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/reference/summarise_outcomes.html b/docs/reference/summarise_outcomes.html new file mode 100644 index 0000000..f16bc42 --- /dev/null +++ b/docs/reference/summarise_outcomes.html @@ -0,0 +1,104 @@ + +Summarise Outcomes — summarise_outcomes • rsvie + + +
    +
    + + + +
    +
    + + +
    +

    This function takes an object x and summarises the outcomes by grouping +by s, outcome, and age_group, then calculates the total number of cases.

    +
    + +
    +
    summarise_outcomes(x)
    +
    + +
    +

    Arguments

    + + +
    x
    +

    An object containing the outcomes data.

    + +
    +
    +

    Value

    +

    A data frame with the total number of cases grouped by s, outcome, and age_group.

    +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.1.

    +
    + +
    + + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..6892064 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,42 @@ + +/404.html +/LICENSE.html +/articles/example_mab.html +/articles/example_mat.html +/articles/example_oa.html +/articles/index.html +/authors.html +/index.html +/reference/RSVProgramme-class.html +/reference/add_economics-RSVProgramme-method.html +/reference/add_economics.html +/reference/add_fitted_dist.html +/reference/add_programme-RSVProgramme-method.html +/reference/add_programme.html +/reference/calculate_daily_uptake.html +/reference/checkout_incidence.html +/reference/checkout_states.html +/reference/compare_interventions.html +/reference/convert_efficacies.html +/reference/convert_mat_to_trans_cal.html +/reference/convert_to_outcomes.html +/reference/covert_raw_to_risk.html +/reference/get_averted_df.html +/reference/get_coverage.html +/reference/get_daily_uptake.html +/reference/get_efficacies_sample.html +/reference/index.html +/reference/make_RunInterventions.html +/reference/make_rsv_programme.html +/reference/output_samples.html +/reference/plot_calendar.html +/reference/plot_economics.html +/reference/plot_economics_fit.html +/reference/plot_outcomes.html +/reference/run-RSVProgramme-method.html +/reference/run.html +/reference/run_state-RSVProgramme-method.html +/reference/run_state.html +/reference/summarise_outcomes.html + + diff --git a/inst/.DS_Store b/inst/.DS_Store deleted file mode 100644 index 1be6895..0000000 Binary files a/inst/.DS_Store and /dev/null differ diff --git a/inst/extdata/.DS_Store b/inst/extdata/.DS_Store deleted file mode 100644 index 13f72c1..0000000 Binary files a/inst/extdata/.DS_Store and /dev/null differ diff --git a/inst/extdata/calendars/cal_mat_none.csv b/inst/extdata/calendars/cal_mat_none.csv new file mode 100644 index 0000000..e8f5a93 --- /dev/null +++ b/inst/extdata/calendars/cal_mat_none.csv @@ -0,0 +1,26 @@ +age_group,start_date,end_date,coverage,uptake +<1mo,,,0, +1mo,,,0, +2mo,,,0, +3mo,,,0, +4mo,,,0, +5mo,,,0, +6mo,,,0, +7mo,,,0, +8mo,,,0, +9mo,,,0, +10mo,,,0, +11mo,,,0, +1yr,,,0, +2yr,,,0, +3yr,,,0, +4yr,,,0, +5-9yr,,,0, +10-14yr,,,0, +15-24yr,,,0.6,birth_rate +25-34yr,,,0.6,birth_rate +35-44yr,,,0.6,birth_rate +45-55yr,,,0, +55-64yr,,,0, +65-74yr,,,0, +75yr,,,0, \ No newline at end of file diff --git a/inst/extdata/econ/econ_pars.csv b/inst/extdata/econ/econ_pars.csv deleted file mode 100644 index d79e5f6..0000000 --- a/inst/extdata/econ/econ_pars.csv +++ /dev/null @@ -1,151 +0,0 @@ -age_group,outcome,ref_qaly,mean_qaly,lb_95_qaly,ub_95_qaly,ref_costs,mean_costs,lb_95_costs,ub_95_costs -<1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -2mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -3mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -4mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -5mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -6mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -7mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -8mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -9mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -10mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -11mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -1yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -2yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -3yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -4yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, -5-9yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -10-14yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -15-24yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -25-34yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -35-44yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -45-55yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -55-64yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -65-74yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -75yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, -<1mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -1mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -2mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -3mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -4mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -5mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -6mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -7mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -8mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -9mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -10mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -11mo,gp,,0,NA,NA,UnitCosts,36,NA,NA -1yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -2yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -3yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -4yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -5-9yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -10-14yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -15-24yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -25-34yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -35-44yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -45-55yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -55-64yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -65-74yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -75yr,gp,,0,NA,NA,UnitCosts,36,NA,NA -<1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -2mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -3mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -4mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -5mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -6mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -7mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -8mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -9mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -10mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -11mo,death,REF,23.278742,18.6229936,27.9344904,,0,, -1yr,death,REF,23.175866,18.5406928,27.8110392,,0,, -2yr,death,REF,23.069326,18.4554608,27.6831912,,0,, -3yr,death,REF,22.958991,18.3671928,27.5507892,,0,, -4yr,death,REF,22.844725,18.27578,27.41367,,0,, -5-9yr,death,REF,22.470175,17.97614,26.96421,,0,, -10-14yr,death,REF,21.765842,17.4126736,26.1190104,,0,, -15-24yr,death,REF,20.661463,16.5291704,24.7937556,,0,, -25-34yr,death,REF,19.386269,15.5090152,23.2635228,,0,, -35-44yr,death,REF,17.64143,14.113144,21.169716,,0,, -45-55yr,death,REF,15.355379,12.2843032,18.4264548,,0,, -55-64yr,death,REF,12.694118,10.1552944,15.2329416,,0,, -65-74yr,death,REF,9.285265,7.428212,11.142318,,0,, -75yr,death,REF,5.07435,4.05948,6.08922,,0,, -<1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -2mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -3mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -4mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -5mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -6mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -7mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -8mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -9mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -10mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -11mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -1yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -2yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -3yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -4yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,2148.297,1922.939,2416.198 -5-9yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,2148.297,1922.939,2416.198 -10-14yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,2148.297,1922.939,2416.198 -15-24yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -25-34yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -35-44yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -45-55yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -55-64yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -65-74yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -75yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1841.789,1691.072,2018.381 -<1mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -1mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -2mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -3mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -4mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -5mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -6mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -7mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -8mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -9mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -10mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -11mo,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -1yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -2yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -3yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -4yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -5-9yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -10-14yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -15-24yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -25-34yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -35-44yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -45-55yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -55-64yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -65-74yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -75yr,a_e,,0,NA,NA,NHSNatCosts21,182.28,NA,NA -<1mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -1mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -2mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -3mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -4mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -5mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -6mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -7mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -8mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -9mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -10mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -11mo,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -1yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -2yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -3yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -4yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -5-9yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -10-14yr,icu,,0,NA,NA,NHSNatCosts21,2940.085,2771.666,3128.086 -15-24yr,icu,,0,NA,NA,NHSNatCosts21,2321.905,2241.851,2395.103 -25-34yr,icu,,0,NA,NA,NHSNatCosts21,2321.905,2241.851,2395.103 -35-44yr,icu,,0,NA,NA,NHSNatCosts21,2321.905,2241.851,2395.103 -45-55yr,icu,,0,NA,NA,NHSNatCosts21,2321.905,2241.851,2395.103 -55-64yr,icu,,0,NA,NA,NHSNatCosts22,2321.905,2241.851,2395.103 -65-74yr,icu,,0,NA,NA,NHSNatCosts23,2321.905,2241.851,2395.103 -75yr,icu,,0,NA,NA,NHSNatCosts24,2321.905,2241.851,2395.103 \ No newline at end of file diff --git a/inst/extdata/econ/econ_pars_ls.csv b/inst/extdata/econ/econ_pars_ls.csv new file mode 100644 index 0000000..27db24b --- /dev/null +++ b/inst/extdata/econ/econ_pars_ls.csv @@ -0,0 +1,151 @@ +age_group,outcome,ref_qaly,mean_qaly,lb_95_qaly,ub_95_qaly,ref_costs,mean_costs,lb_95_costs,ub_95_costs +<1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +2mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +3mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +4mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +5mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +6mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +7mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +8mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +9mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +10mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +11mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +1yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +2yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +3yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +4yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +5-9yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +10-14yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +15-24yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +25-34yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +35-44yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +45-55yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +55-64yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +65-74yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +75yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +<1mo,gp,,0,,,UnitCosts,36,NA,NA +1mo,gp,,0,,,UnitCosts,36,NA,NA +2mo,gp,,0,,,UnitCosts,36,NA,NA +3mo,gp,,0,,,UnitCosts,36,NA,NA +4mo,gp,,0,,,UnitCosts,36,NA,NA +5mo,gp,,0,,,UnitCosts,36,NA,NA +6mo,gp,,0,,,UnitCosts,36,NA,NA +7mo,gp,,0,,,UnitCosts,36,NA,NA +8mo,gp,,0,,,UnitCosts,36,NA,NA +9mo,gp,,0,,,UnitCosts,36,NA,NA +10mo,gp,,0,,,UnitCosts,36,NA,NA +11mo,gp,,0,,,UnitCosts,36,NA,NA +1yr,gp,,0,,,UnitCosts,36,NA,NA +2yr,gp,,0,,,UnitCosts,36,NA,NA +3yr,gp,,0,,,UnitCosts,36,NA,NA +4yr,gp,,0,,,UnitCosts,36,NA,NA +5-9yr,gp,,0,,,UnitCosts,36,NA,NA +10-14yr,gp,,0,,,UnitCosts,36,NA,NA +15-24yr,gp,,0,,,UnitCosts,36,NA,NA +25-34yr,gp,,0,,,UnitCosts,36,NA,NA +35-44yr,gp,,0,,,UnitCosts,36,NA,NA +45-55yr,gp,,0,,,UnitCosts,36,NA,NA +55-64yr,gp,,0,,,UnitCosts,36,NA,NA +65-74yr,gp,,0,,,UnitCosts,36,NA,NA +75yr,gp,,0,,,UnitCosts,36,NA,NA +<1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +2mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +3mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +4mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +5mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +6mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +7mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +8mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +9mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +10mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +11mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +1yr,death,REF,23.175866,18.5406928,27.8110392,,0,, +2yr,death,REF,23.069326,18.4554608,27.6831912,,0,, +3yr,death,REF,22.958991,18.3671928,27.5507892,,0,, +4yr,death,REF,22.844725,18.27578,27.41367,,0,, +5-9yr,death,REF,22.470175,17.97614,26.96421,,0,, +10-14yr,death,REF,21.765842,17.4126736,26.1190104,,0,, +15-24yr,death,REF,20.661463,16.5291704,24.7937556,,0,, +25-34yr,death,REF,19.386269,15.5090152,23.2635228,,0,, +35-44yr,death,REF,17.64143,14.113144,21.169716,,0,, +45-55yr,death,REF,15.355379,12.2843032,18.4264548,,0,, +55-64yr,death,REF,12.694118,10.1552944,15.2329416,,0,, +65-74yr,death,REF,9.285265,7.428212,11.142318,,0,, +75yr,death,REF,5.07435,4.05948,6.08922,,0,, +<1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +2mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +3mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +4mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +5mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +6mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +7mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +8mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +9mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +10mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +11mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +1yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +2yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +3yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +4yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1909.86,1599.19,3711.22 +5-9yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1909.86,1599.19,3711.22 +10-14yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1909.86,1599.19,3711.22 +15-24yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +25-34yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +35-44yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +45-55yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +55-64yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +65-74yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +75yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1753.21,1233.3,2739.47 +<1mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +1mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +2mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +3mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +4mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +5mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +6mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +7mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +8mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +9mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +10mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +11mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +1yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +2yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +3yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +4yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +5-9yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +10-14yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +15-24yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +25-34yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +35-44yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +45-55yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +55-64yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +65-74yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +75yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +<1mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +1mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +2mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +3mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +4mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +5mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +6mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +7mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +8mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +9mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +10mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +11mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +1yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +2yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +3yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +4yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +5-9yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +10-14yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +15-24yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +25-34yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +35-44yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +45-55yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +55-64yr,icu,Hodgson2020,0,,,NHSNatCosts22,2324.8,1948.25,2653.25 +65-74yr,icu,Hodgson2020,0,,,NHSNatCosts23,2324.8,1948.25,2653.25 +75yr,icu,Hodgson2020,0,,,NHSNatCosts24,2324.8,1948.25,2653.25 \ No newline at end of file diff --git a/inst/extdata/econ/econ_pars_ss.csv b/inst/extdata/econ/econ_pars_ss.csv new file mode 100644 index 0000000..e35bf19 --- /dev/null +++ b/inst/extdata/econ/econ_pars_ss.csv @@ -0,0 +1,151 @@ +age_group,outcome,ref_qaly,mean_qaly,lb_95_qaly,ub_95_qaly,ref_costs,mean_costs,lb_95_costs,ub_95_costs +<1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +1mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +2mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +3mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +4mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +5mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +6mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +7mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +8mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +9mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +10mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +11mo,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +1yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +2yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +3yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +4yr,symptomatic,Hodgson2020,0.002336,0.000269,0.009255,,0,, +5-9yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +10-14yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +15-24yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +25-34yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +35-44yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +45-55yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +55-64yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +65-74yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +75yr,symptomatic,Hodgson2020,0.001448,0.000135,0.005928,,0,, +<1mo,gp,,0,,,UnitCosts,36,NA,NA +1mo,gp,,0,,,UnitCosts,36,NA,NA +2mo,gp,,0,,,UnitCosts,36,NA,NA +3mo,gp,,0,,,UnitCosts,36,NA,NA +4mo,gp,,0,,,UnitCosts,36,NA,NA +5mo,gp,,0,,,UnitCosts,36,NA,NA +6mo,gp,,0,,,UnitCosts,36,NA,NA +7mo,gp,,0,,,UnitCosts,36,NA,NA +8mo,gp,,0,,,UnitCosts,36,NA,NA +9mo,gp,,0,,,UnitCosts,36,NA,NA +10mo,gp,,0,,,UnitCosts,36,NA,NA +11mo,gp,,0,,,UnitCosts,36,NA,NA +1yr,gp,,0,,,UnitCosts,36,NA,NA +2yr,gp,,0,,,UnitCosts,36,NA,NA +3yr,gp,,0,,,UnitCosts,36,NA,NA +4yr,gp,,0,,,UnitCosts,36,NA,NA +5-9yr,gp,,0,,,UnitCosts,36,NA,NA +10-14yr,gp,,0,,,UnitCosts,36,NA,NA +15-24yr,gp,,0,,,UnitCosts,36,NA,NA +25-34yr,gp,,0,,,UnitCosts,36,NA,NA +35-44yr,gp,,0,,,UnitCosts,36,NA,NA +45-55yr,gp,,0,,,UnitCosts,36,NA,NA +55-64yr,gp,,0,,,UnitCosts,36,NA,NA +65-74yr,gp,,0,,,UnitCosts,36,NA,NA +75yr,gp,,0,,,UnitCosts,36,NA,NA +<1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +1mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +2mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +3mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +4mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +5mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +6mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +7mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +8mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +9mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +10mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +11mo,death,REF,23.278742,18.6229936,27.9344904,,0,, +1yr,death,REF,23.175866,18.5406928,27.8110392,,0,, +2yr,death,REF,23.069326,18.4554608,27.6831912,,0,, +3yr,death,REF,22.958991,18.3671928,27.5507892,,0,, +4yr,death,REF,22.844725,18.27578,27.41367,,0,, +5-9yr,death,REF,22.470175,17.97614,26.96421,,0,, +10-14yr,death,REF,21.765842,17.4126736,26.1190104,,0,, +15-24yr,death,REF,20.661463,16.5291704,24.7937556,,0,, +25-34yr,death,REF,19.386269,15.5090152,23.2635228,,0,, +35-44yr,death,REF,17.64143,14.113144,21.169716,,0,, +45-55yr,death,REF,15.355379,12.2843032,18.4264548,,0,, +55-64yr,death,REF,12.694118,10.1552944,15.2329416,,0,, +65-74yr,death,REF,9.285265,7.428212,11.142318,,0,, +75yr,death,REF,5.07435,4.05948,6.08922,,0,, +<1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +1mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +2mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +3mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +4mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +5mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +6mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +7mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +8mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +9mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +10mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +11mo,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +1yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +2yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +3yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +4yr,hosp,Hodgson2020,0.004098,0.000624,0.013141,NHSNatCosts21,1100.23,1029.66,1253.16 +5-9yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1100.23,1029.66,1253.16 +10-14yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,1100.23,1029.66,1253.16 +15-24yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +25-34yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +35-44yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +45-55yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +55-64yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +65-74yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +75yr,hosp,Hodgson2020,0.00299,0.000346,0.011387,NHSNatCosts21,652.29,585.37,740.31 +<1mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +1mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +2mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +3mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +4mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +5mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +6mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +7mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +8mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +9mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +10mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +11mo,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +1yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +2yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +3yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +4yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +5-9yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +10-14yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +15-24yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +25-34yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +35-44yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +45-55yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +55-64yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +65-74yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +75yr,a_e,Hodgson2020,0,,,NHSNatCosts21,289.59,173.41,452.41 +<1mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +1mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +2mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +3mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +4mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +5mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +6mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +7mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +8mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +9mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +10mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +11mo,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +1yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +2yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +3yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +4yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +5-9yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +10-14yr,icu,Hodgson2020,0,,,NHSNatCosts21,2905.2,2282.8,3862.67 +15-24yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +25-34yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +35-44yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +45-55yr,icu,Hodgson2020,0,,,NHSNatCosts21,2324.8,1948.25,2653.25 +55-64yr,icu,Hodgson2020,0,,,NHSNatCosts22,2324.8,1948.25,2653.25 +65-74yr,icu,Hodgson2020,0,,,NHSNatCosts23,2324.8,1948.25,2653.25 +75yr,icu,Hodgson2020,0,,,NHSNatCosts24,2324.8,1948.25,2653.25 \ No newline at end of file diff --git a/inst/extdata/econ/outcomes_incidence.csv b/inst/extdata/econ/outcomes_incidence.csv index cb96ca4..bddf9a1 100644 --- a/inst/extdata/econ/outcomes_incidence.csv +++ b/inst/extdata/econ/outcomes_incidence.csv @@ -70,10 +70,10 @@ 15-24yr,inc,death,Fleming2015,0,0,1 25-34yr,inc,death,Fleming2015,0,0,1 35-44yr,inc,death,Fleming2015,0,0,1 -45-55yr,inc,death,Fleming2015,6,5,7 -55-64yr,inc,death,Fleming2015,6,5,7 -65-74yr,inc,death,Fleming2015,29,21,33 -75yr,inc,death,Fleming2015,155,108,213 +45-55yr,inc,death,Fleming2015,1.83,1.342,2.196 +55-64yr,inc,death,Fleming2015,1.83,1.342,2.196 +65-74yr,inc,death,Fleming2015,4.331,3.172,5.49 +75yr,inc,death,Fleming2015,15.311,11.346,19.276 <1mo,n,hosp,Reeves2019,1772,1712,1913 1mo,n,hosp,Reeves2019,4174,3995,4312 2mo,n,hosp,Reeves2019,3184,3073,3371 @@ -100,21 +100,21 @@ 65-74yr,inc,hosp,Sharpe2022,71,52,90 75yr,inc,hosp,Sharpe2022,251,186,316 <1mo,inc,a_e,AjayiObe2008,11200,NA,NA -1mo,inc,a_e,AjayiObe2008,10683,NA,NA -2mo,inc,a_e,AjayiObe2008,4764,NA,NA -3mo,inc,a_e,AjayiObe2008,3726,NA,NA -4mo,inc,a_e,AjayiObe2008,1356,NA,NA -5mo,inc,a_e,AjayiObe2008,1122,NA,NA -6mo,inc,a_e,AjayiObe2008,241,NA,NA -7mo,inc,a_e,AjayiObe2008,0,NA,NA -8mo,inc,a_e,AjayiObe2008,0,NA,NA -9mo,inc,a_e,AjayiObe2008,0,NA,NA -10mo,inc,a_e,AjayiObe2008,0,NA,NA -11mo,inc,a_e,AjayiObe2008,0,NA,NA -1yr,inc,a_e,AjayiObe2008,0,NA,NA -2yr,inc,a_e,AjayiObe2008,0,NA,NA -3yr,inc,a_e,AjayiObe2008,0,NA,NA -4yr,inc,a_e,AjayiObe2008,0,NA,NA +1mo,inc,a_e,AjayiObe2008,11200,NA,NA +2mo,inc,a_e,AjayiObe2008,11200,NA,NA +3mo,inc,a_e,AjayiObe2008,11200,NA,NA +4mo,inc,a_e,AjayiObe2008,11200,NA,NA +5mo,inc,a_e,AjayiObe2008,11200,NA,NA +6mo,inc,a_e,AjayiObe2008,10683,NA,NA +7mo,inc,a_e,AjayiObe2008,10683,NA,NA +8mo,inc,a_e,AjayiObe2008,10683,NA,NA +9mo,inc,a_e,AjayiObe2008,10683,NA,NA +10mo,inc,a_e,AjayiObe2008,10683,NA,NA +11mo,inc,a_e,AjayiObe2008,10683,NA,NA +1yr,inc,a_e,AjayiObe2008,4764,NA,NA +2yr,inc,a_e,AjayiObe2008,3726,NA,NA +3yr,inc,a_e,AjayiObe2008,1356,NA,NA +4yr,inc,a_e,AjayiObe2008,1122,NA,NA 5-9yr,inc,a_e,AjayiObe2008,0,NA,NA 10-14yr,inc,a_e,AjayiObe2008,0,NA,NA 15-24yr,inc,a_e,AjayiObe2008,0,NA,NA @@ -145,7 +145,7 @@ 15-24yr,inc,icu,Thwaites2020,0,0,0 25-34yr,inc,icu,Thwaites2020,0,0,0 35-44yr,inc,icu,Thwaites2020,0,0,0 -45-55yr,inc,icu,Thwaites2020,0,0,0 +45-55yr,inc,icu,Walsh2020,6,4.4,7.2 55-64yr,inc,icu,Walsh2020,6,4.4,7.2 -65-74yr,inc,icu,Walsh2020,14.2,10.4,18 -75yr,inc,icu,Walsh2020,50.2,37.2,63.2 \ No newline at end of file +65-74yr,inc,icu,Walsh2020,18.46,13.52,23.4 +75yr,inc,icu,Walsh2020,65.26,48.36,82.16 \ No newline at end of file diff --git a/inst/extdata/econ/outcomes_incidence_high_mort.csv b/inst/extdata/econ/outcomes_incidence_high_mort.csv new file mode 100644 index 0000000..62b11c5 --- /dev/null +++ b/inst/extdata/econ/outcomes_incidence_high_mort.csv @@ -0,0 +1,151 @@ +age_group,metric,outcome,ref,mean,lb_95,ub_95 +<1mo,inc_inf,symptomatic,Model,90840,84200,96900 +1mo,inc_inf,symptomatic,Model,90840,84200,96900 +2mo,inc_inf,symptomatic,Model,90840,84200,96900 +3mo,inc_inf,symptomatic,Model,90840,84200,96900 +4mo,inc_inf,symptomatic,Model,90840,84200,96900 +5mo,inc_inf,symptomatic,Model,90840,84200,96900 +6mo,inc_inf,symptomatic,Model,90840,84200,96900 +7mo,inc_inf,symptomatic,Model,90840,84200,96900 +8mo,inc_inf,symptomatic,Model,90840,84200,96900 +9mo,inc_inf,symptomatic,Model,90840,84200,96900 +10mo,inc_inf,symptomatic,Model,90840,84200,96900 +11mo,inc_inf,symptomatic,Model,90840,84200,96900 +1yr,inc_inf,symptomatic,Model,83700,77700,90800 +2yr,inc_inf,symptomatic,Model,83700,77700,90800 +3yr,inc_inf,symptomatic,Model,83700,77700,90800 +4yr,inc_inf,symptomatic,Model,83700,77700,90800 +5-9yr,inc_inf,symptomatic,Model,48400,42800,54000 +10-14yr,inc_inf,symptomatic,Model,48400,42800,54000 +15-24yr,inc_inf,symptomatic,Model,24700,17100,34400 +25-34yr,inc_inf,symptomatic,Model,24700,17100,34400 +35-44yr,inc_inf,symptomatic,Model,24700,17100,34400 +45-55yr,inc_inf,symptomatic,Model,24700,17100,34400 +55-64yr,inc_inf,symptomatic,Model,24700,17100,34400 +65-74yr,inc_inf,symptomatic,Model,24700,17100,34400 +75yr,inc_inf,symptomatic,Model,24700,17100,34400 +<1mo,inc,gp,Cromer2017,21420,21130,21700 +1mo,inc,gp,Cromer2017,21420,21130,21700 +2mo,inc,gp,Cromer2017,21420,21130,21700 +3mo,inc,gp,Cromer2017,21420,21130,21700 +4mo,inc,gp,Cromer2017,21420,21130,21700 +5mo,inc,gp,Cromer2017,21420,21130,21700 +6mo,inc,gp,Cromer2017,10920,10770,11060 +7mo,inc,gp,Cromer2017,10920,10770,11060 +8mo,inc,gp,Cromer2017,10920,10770,11060 +9mo,inc,gp,Cromer2017,10920,10770,11060 +10mo,inc,gp,Cromer2017,10920,10770,11060 +11mo,inc,gp,Cromer2017,10920,10770,11060 +1yr,inc,gp,Cromer2017,10920,10770,11060 +2yr,inc,gp,Cromer2017,10920,10770,11060 +3yr,inc,gp,Cromer2017,10920,10770,11060 +4yr,inc,gp,Cromer2017,10920,10770,11060 +5-9yr,inc,gp,Taylor2016,1114,632,1596 +10-14yr,inc,gp,Taylor2016,1114,632,1596 +15-24yr,inc,gp,Fleming2015,677,443,850 +25-34yr,inc,gp,Fleming2015,677,443,850 +35-44yr,inc,gp,Fleming2015,677,443,850 +45-55yr,inc,gp,Fleming2015,1325,928,1542 +55-64yr,inc,gp,Fleming2015,1325,928,1542 +65-74yr,inc,gp,Fleming2015,1742,1259,2038 +75yr,inc,gp,Fleming2015,2175,1554,2516 +<1mo,inc,death,Cromer2017,2.48,2.38,2.58 +1mo,inc,death,Cromer2017,2.48,2.38,2.58 +2mo,inc,death,Cromer2017,2.48,2.38,2.58 +3mo,inc,death,Cromer2017,2.48,2.38,2.58 +4mo,inc,death,Cromer2017,2.48,2.38,2.58 +5mo,inc,death,Cromer2017,2.48,2.38,2.58 +6mo,inc,death,Cromer2017,0.66,0.64,0.68 +7mo,inc,death,Cromer2017,0.66,0.64,0.68 +8mo,inc,death,Cromer2017,0.66,0.64,0.68 +9mo,inc,death,Cromer2017,0.66,0.64,0.68 +10mo,inc,death,Cromer2017,0.66,0.64,0.68 +11mo,inc,death,Cromer2017,0.66,0.64,0.68 +1yr,inc,death,Cromer2017,0.66,0.64,0.68 +2yr,inc,death,Cromer2017,0.66,0.64,0.68 +3yr,inc,death,Cromer2017,0.66,0.64,0.68 +4yr,inc,death,Cromer2017,0.66,0.64,0.68 +5-9yr,inc,death,Taylor2016,0,0,0 +10-14yr,inc,death,Taylor2016,0,0,0 +15-24yr,inc,death,Fleming2015,0,0,1 +25-34yr,inc,death,Fleming2015,0,0,1 +35-44yr,inc,death,Fleming2015,0,0,1 +45-55yr,inc,death,Fleming2015,6,5,7 +55-64yr,inc,death,Fleming2015,6,5,7 +65-74yr,inc,death,Fleming2015,29,21,33 +75yr,inc,death,Fleming2015,155,108,213 +<1mo,n,hosp,Reeves2019,1772,1712,1913 +1mo,n,hosp,Reeves2019,4174,3995,4312 +2mo,n,hosp,Reeves2019,3184,3073,3371 +3mo,n,hosp,Reeves2019,2323,2201,2451 +4mo,n,hosp,Reeves2019,2013,1895,2174 +5mo,n,hosp,Reeves2019,1661,1563,1791 +6mo,n,hosp,Reeves2019,1359,1269,1502 +7mo,n,hosp,Reeves2019,1121,1051,1274 +8mo,n,hosp,Reeves2019,911,836,1051 +9mo,n,hosp,Reeves2019,771,698,897 +10mo,n,hosp,Reeves2019,580,528,693 +11mo,n,hosp,Reeves2019,493,419,603 +1yr,n,hosp,Reeves2017,2562.75,2153.25,3187.75 +2yr,n,hosp,Reeves2017,2562.75,2153.25,3187.75 +3yr,n,hosp,Reeves2017,2562.75,2153.25,3187.75 +4yr,n,hosp,Reeves2017,2562.75,2153.25,3187.75 +5-9yr,inc,hosp,Taylor2016,0,0,0 +10-14yr,inc,hosp,Taylor2016,0,0,0 +15-24yr,inc,hosp,Fleming2015,4,3,5 +25-34yr,inc,hosp,Fleming2015,4,3,5 +35-44yr,inc,hosp,Fleming2015,4,3,5 +45-55yr,inc,hosp,Fleming2015,30,22,36 +55-64yr,inc,hosp,Fleming2015,30,22,36 +65-74yr,inc,hosp,Sharpe2022,71,52,90 +75yr,inc,hosp,Sharpe2022,251,186,316 +<1mo,inc,a_e,AjayiObe2008,11200,NA,NA +1mo,inc,a_e,AjayiObe2008,11200,NA,NA +2mo,inc,a_e,AjayiObe2008,11200,NA,NA +3mo,inc,a_e,AjayiObe2008,11200,NA,NA +4mo,inc,a_e,AjayiObe2008,11200,NA,NA +5mo,inc,a_e,AjayiObe2008,11200,NA,NA +6mo,inc,a_e,AjayiObe2008,10683,NA,NA +7mo,inc,a_e,AjayiObe2008,10683,NA,NA +8mo,inc,a_e,AjayiObe2008,10683,NA,NA +9mo,inc,a_e,AjayiObe2008,10683,NA,NA +10mo,inc,a_e,AjayiObe2008,10683,NA,NA +11mo,inc,a_e,AjayiObe2008,10683,NA,NA +1yr,inc,a_e,AjayiObe2008,4764,NA,NA +2yr,inc,a_e,AjayiObe2008,3726,NA,NA +3yr,inc,a_e,AjayiObe2008,1356,NA,NA +4yr,inc,a_e,AjayiObe2008,1122,NA,NA +5-9yr,inc,a_e,AjayiObe2008,0,NA,NA +10-14yr,inc,a_e,AjayiObe2008,0,NA,NA +15-24yr,inc,a_e,AjayiObe2008,0,NA,NA +25-34yr,inc,a_e,AjayiObe2008,0,NA,NA +35-44yr,inc,a_e,AjayiObe2008,0,NA,NA +45-55yr,inc,a_e,AjayiObe2008,0,NA,NA +55-64yr,inc,a_e,AjayiObe2008,0,NA,NA +65-74yr,inc,a_e,AjayiObe2008,0,NA,NA +75yr,inc,a_e,AjayiObe2008,0,NA,NA +<1mo,n,icu,Thwaites2020,76.196,73.616,82.259 +1mo,n,icu,Thwaites2020,179.482,171.785,185.416 +2mo,n,icu,Thwaites2020,136.912,132.139,144.953 +3mo,n,icu,Thwaites2020,99.889,94.643,105.393 +4mo,n,icu,Thwaites2020,86.559,81.485,93.482 +5mo,n,icu,Thwaites2020,71.423,67.209,77.013 +6mo,n,icu,Thwaites2020,58.437,54.567,64.586 +7mo,n,icu,Thwaites2020,48.203,45.193,54.782 +8mo,n,icu,Thwaites2020,39.173,35.948,45.193 +9mo,n,icu,Thwaites2020,33.153,30.014,38.571 +10mo,n,icu,Thwaites2020,24.94,22.704,29.799 +11mo,n,icu,Thwaites2020,21.199,18.017,25.929 +1yr,n,icu,Thwaites2020,110.19825,92.58975,137.07325 +2yr,n,icu,Thwaites2020,0,0,0 +3yr,n,icu,Thwaites2020,0,0,0 +4yr,n,icu,Thwaites2020,0,0,0 +5-9yr,inc,icu,Thwaites2020,0,0,0 +10-14yr,inc,icu,Thwaites2020,0,0,0 +15-24yr,inc,icu,Thwaites2020,0,0,0 +25-34yr,inc,icu,Thwaites2020,0,0,0 +35-44yr,inc,icu,Thwaites2020,0,0,0 +45-55yr,inc,icu,Walsh2020,6,4.4,7.2 +55-64yr,inc,icu,Walsh2020,6,4.4,7.2 +65-74yr,inc,icu,Walsh2020,18.46,13.52,23.4 +75yr,inc,icu,Walsh2020,65.26,48.36,82.16 \ No newline at end of file diff --git a/inst/extdata/econ/outcomes_incidence_high_mort.xls b/inst/extdata/econ/outcomes_incidence_high_mort.xls new file mode 100644 index 0000000..dd87100 Binary files /dev/null and b/inst/extdata/econ/outcomes_incidence_high_mort.xls differ diff --git a/inst/extdata/econ/outcomes_incidence_master.xls b/inst/extdata/econ/outcomes_incidence_master.xls new file mode 100644 index 0000000..889bba7 Binary files /dev/null and b/inst/extdata/econ/outcomes_incidence_master.xls differ diff --git a/inst/extdata/econ/outcomes_incidence_master_high_mort.xls b/inst/extdata/econ/outcomes_incidence_master_high_mort.xls new file mode 100644 index 0000000..8c19f1b Binary files /dev/null and b/inst/extdata/econ/outcomes_incidence_master_high_mort.xls differ diff --git a/inst/extdata/efficacies/immune_profiles_bounded.RDS b/inst/extdata/efficacies/immune_profiles_bounded.RDS new file mode 100644 index 0000000..e424718 Binary files /dev/null and b/inst/extdata/efficacies/immune_profiles_bounded.RDS differ diff --git a/inst/extdata/efficacies/immune_profiles_unbound.RDS b/inst/extdata/efficacies/immune_profiles_unbound.RDS new file mode 100644 index 0000000..5eee286 Binary files /dev/null and b/inst/extdata/efficacies/immune_profiles_unbound.RDS differ diff --git a/man/RSVProgramme-class.Rd b/man/RSVProgramme-class.Rd new file mode 100644 index 0000000..f99b498 --- /dev/null +++ b/man/RSVProgramme-class.Rd @@ -0,0 +1,63 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/programmeClass.R +\docType{class} +\name{RSVProgramme-class} +\alias{RSVProgramme-class} +\title{RSVProgramme Class} +\description{ +A class to represent an RSV (Respiratory Syncytial Virus) Programme. +} +\section{Slots}{ + +\describe{ +\item{\code{econ_name}}{A character string representing the economic name.} + +\item{\code{prog_name}}{A character string representing the programme name.} + +\item{\code{model}}{An object of class refClass representing the model.} + +\item{\code{uk_data}}{A list containing UK data.} + +\item{\code{model_par}}{A list of model parameters.} + +\item{\code{econ_par}}{A list of economic parameters.} + +\item{\code{model_calendar}}{A list representing the model calendar.} + +\item{\code{dose_calendar}}{A list representing the dose calendar.} + +\item{\code{immune_profile}}{A list representing the immune profile.} + +\item{\code{econ_df}}{A data.frame containing economic data.} + +\item{\code{risks_df}}{A data.frame containing risk data.} + +\item{\code{risks_vhr_df}}{A data.frame containing very high risk data.} + +\item{\code{outcomes_vec}}{A vector of outcomes.} + +\item{\code{post}}{A data.frame containing posterior data.} + +\item{\code{seeds}}{A vector of seeds.} + +\item{\code{S}}{A numeric value.} + +\item{\code{raw_inci}}{A list of raw incidence data.} + +\item{\code{wane_func_string}}{A character string representing the waning function.} + +\item{\code{wane_func_string_vhr}}{A character string representing the waning function for very high risk.} + +\item{\code{outcomes}}{A list of outcomes.} + +\item{\code{samples_outcomes}}{A list of sample outcomes.} + +\item{\code{samples_outcomes_VHR}}{A list of sample outcomes for very high risk.} + +\item{\code{efficacies}}{A vector of efficacies.} + +\item{\code{cov_mat}}{A numeric matrix representing the covariance matrix.} + +\item{\code{full_output}}{A logical value indicating whether to produce full output.} +}} + diff --git a/man/add_economics-RSVProgramme-method.Rd b/man/add_economics-RSVProgramme-method.Rd index 8398726..84a67fb 100644 --- a/man/add_economics-RSVProgramme-method.Rd +++ b/man/add_economics-RSVProgramme-method.Rd @@ -2,22 +2,40 @@ % Please edit documentation in R/programmeClass.R \name{add_economics,RSVProgramme-method} \alias{add_economics,RSVProgramme-method} -\title{A setMethod for the \code{add_economics} function} +\title{Add Economics Data to RSVProgramme Object} \usage{ \S4method{add_economics}{RSVProgramme}(object, econ_name, econ_raw, risks_raw, risks_vhr_raw) } \arguments{ -\item{econ_name}{a string for the name gven the economic framework given} +\item{object}{An object of class \code{RSVProgramme}.} -\item{econ_raw}{a dataframe with the economic parameters per age group.} +\item{econ_name}{A character string representing the name of the economic data.} -\item{risks_raw}{a dataframe with the risk of outcomes per age group.} +\item{econ_raw}{A data frame containing the raw economic data.} -\item{risks_vhr_raw}{a dataframe with the risk of outcomes per age group for very-high-risk infants} +\item{risks_raw}{A data frame containing the raw risks data.} + +\item{risks_vhr_raw}{A data frame containing the raw very high risk (VHR) data.} } \value{ -An RSVProgramme object +The updated \code{RSVProgramme} object with the added economic data. } \description{ -A setMethod for the \code{add_economics} function +This method adds economic data to an RSVProgramme object. +} +\details{ +This method performs the following steps: +\itemize{ +\item Checks if the output directory for the economic data exists, and creates it if it does not. +\item Assigns the provided economic data and risk data to the corresponding slots in the \code{RSVProgramme} object. +\item Extracts unique outcomes from the economic data and assigns them to the \code{outcomes_vec} slot. +\item Stops execution if no outcomes are detected in the economic data. +\item Generates samples of outcomes and assigns them to the \code{samples_outcomes} and \code{samples_outcomes_VHR} slots. +} +} +\examples{ +\dontrun{ + rsv_programme <- new("RSVProgramme") + rsv_programme <- add_economics(rsv_programme, "econ_data", econ_raw_df, risks_raw_df, risks_vhr_raw_df) +} } diff --git a/man/add_economics.Rd b/man/add_economics.Rd new file mode 100644 index 0000000..9543ada --- /dev/null +++ b/man/add_economics.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/programmeClass.R +\name{add_economics} +\alias{add_economics} +\title{Add Economics Data to an Object} +\usage{ +add_economics(object, econ_name, econ_raw, risks_raw, risks_vhr_raw) +} +\arguments{ +\item{object}{The object to which the economics data will be added.} + +\item{econ_name}{A character string representing the name of the economics data.} + +\item{econ_raw}{The raw economics data to be added.} + +\item{risks_raw}{The raw risks data associated with the economics data.} + +\item{risks_vhr_raw}{The raw very high risk data associated with the economics data.} +} +\value{ +The object with the added economics data. +} +\description{ +This generic function is used to add economics data to a specified object. +} diff --git a/man/add_fitted_dist.Rd b/man/add_fitted_dist.Rd new file mode 100644 index 0000000..6c2f137 --- /dev/null +++ b/man/add_fitted_dist.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_economics_methods.R +\name{add_fitted_dist} +\alias{add_fitted_dist} +\title{Add Fitted Distribution to Data Frame} +\usage{ +add_fitted_dist(cost_df, dist) +} +\arguments{ +\item{cost_df}{A data frame containing the data to which the distribution will be fitted. The data frame should have columns named "mean", "lb_95", and "ub_95".} + +\item{dist}{A character string specifying the distribution to fit. The distribution should be one of the distributions supported by the \code{q} function in R (e.g., "norm" for normal distribution, "tri" for triangular distribution).} +} +\value{ +A data frame with an additional column named \code{fitt_dist} containing the fitted distribution for each row. +} +\description{ +This function fits a specified distribution to the data in a given data frame and adds the fitted distribution as a new column. +} +\examples{ +\dontrun{ +cost_df <- data.frame(mean = c(10, 20), lb_95 = c(5, 15), ub_95 = c(15, 25)) +add_fitted_dist(cost_df, "norm") +} + +} diff --git a/man/add_programme-RSVProgramme-method.Rd b/man/add_programme-RSVProgramme-method.Rd index bfb4ae4..1000728 100644 --- a/man/add_programme-RSVProgramme-method.Rd +++ b/man/add_programme-RSVProgramme-method.Rd @@ -2,22 +2,27 @@ % Please edit documentation in R/programmeClass.R \name{add_programme,RSVProgramme-method} \alias{add_programme,RSVProgramme-method} -\title{A setMethod for the \code{add_programme} function} +\title{Add Programme to RSVProgramme Object} \usage{ \S4method{add_programme}{RSVProgramme}(object, prog_name, cal, cal_vhr, immune_profile) } \arguments{ -\item{prog_name}{an integer taking the number of Monte Carlo samples to run over} +\item{object}{An object of class \code{RSVProgramme}.} -\item{cal}{a dataframe with the implementation calendar for the population} +\item{prog_name}{A character string representing the name of the programme.} -\item{cal_vhr}{dataframe with the implementation calendar for the very-high-risk population} +\item{cal}{A calendar object used for the programme.} -\item{immune_profile}{a list with information about the immune asumptions if the prophylatic in the programme} +\item{cal_vhr}{A calendar object for very high-risk (VHR) groups.} + +\item{immune_profile}{A list containing the immune profile information.} } \value{ -An RSVProgramme object +The updated \code{RSVProgramme} object with the new programme added. } \description{ -A setMethod for the \code{add_programme} function +This method adds a programme to an RSVProgramme object, setting various attributes and creating necessary directories. +} +\details{ +This function sets the programme name, checks and creates necessary directories, initializes dose and sero matrices, calculates daily uptake, converts matrices to transmission calendars, and sets various attributes in the \code{RSVProgramme} object. } diff --git a/man/add_programme.Rd b/man/add_programme.Rd new file mode 100644 index 0000000..06b460d --- /dev/null +++ b/man/add_programme.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/programmeClass.R +\name{add_programme} +\alias{add_programme} +\title{Add Programme} +\usage{ +add_programme(object, prog_name, cal, cal_vhr, immune_profile) +} +\arguments{ +\item{object}{The object to which the programme will be added.} + +\item{prog_name}{The name of the programme to be added.} + +\item{cal}{The calendar associated with the programme.} + +\item{cal_vhr}{The calendar with very high resolution associated with the programme.} + +\item{immune_profile}{The immune profile associated with the programme.} +} +\value{ +The object with the added programme. +} +\description{ +This function is a generic method for adding a programme to an object. +} diff --git a/man/calculate_daily_uptake.Rd b/man/calculate_daily_uptake.Rd index e335c1a..9d1fff4 100644 --- a/man/calculate_daily_uptake.Rd +++ b/man/calculate_daily_uptake.Rd @@ -2,15 +2,29 @@ % Please edit documentation in R/add_programme_methods.R \name{calculate_daily_uptake} \alias{calculate_daily_uptake} -\title{Convert daily uptake from calendar to model} +\title{Calculate Daily Uptake} \usage{ calculate_daily_uptake(object, cal_df) } \arguments{ -\item{object}{am S4 class of the defined RSV programme} +\item{object}{An object containing the UK data with age group boundaries.} -\item{cal_df}{a dataframe of a calendar being evaluated} +\item{cal_df}{A data frame containing the start and end dates, and uptake types for each age group.} +} +\value{ +A matrix with 365 rows (days) and 25 columns (age groups) representing the daily uptake. } \description{ -Convert mean and ci into samples from a fitted distribution. +This function calculates the daily uptake for different age groups based on the provided calibration data frame. +} +\details{ +The function processes each age group, calculates the start and end positions within the year, and fills the uptake matrix accordingly. +Different uptake types such as "linear", "birth_rate", "flu_oa", and "oa_2425" are handled. +} +\examples{ +\dontrun{ +object <- your_object_with_uk_data +cal_df <- your_calibration_data_frame +daily_uptake_matrix <- calculate_daily_uptake(object, cal_df) +} } diff --git a/man/checkout_incidence.Rd b/man/checkout_incidence.Rd index 550b3a5..a36ad6f 100644 --- a/man/checkout_incidence.Rd +++ b/man/checkout_incidence.Rd @@ -4,14 +4,23 @@ \alias{checkout_incidence} \title{function to conver the incidence matrix from a run to a data.frame} \usage{ -checkout_incidence(object, rerun = TRUE) +checkout_incidence(object, rerun = FALSE) } \arguments{ -\item{object}{an RSVProgramme object} +\item{object}{An object containing the raw incidence data.} + +\item{rerun}{A logical value indicating whether to rerun the \code{rsvie::run} function on the object. Default is TRUE.} } \value{ none + +A data frame containing the processed incidence data with additional columns for time, age group, social group, and risk group. } \description{ -function to conver the incidence matrix from a run to a data.frame +This function processes the incidence data from an object. +} +\examples{ +\dontrun{ + result <- checkout_incidence(my_object) +} } diff --git a/man/checkout_states.Rd b/man/checkout_states.Rd index a4ce707..0d41263 100644 --- a/man/checkout_states.Rd +++ b/man/checkout_states.Rd @@ -2,16 +2,19 @@ % Please edit documentation in R/utils.R \name{checkout_states} \alias{checkout_states} -\title{function to conver the incidence matrix from a state run to a data.frame} +\title{Checkout States} \usage{ checkout_states(object) } \arguments{ -\item{object}{an RSVProgramme object} +\item{object}{An object containing the states to be processed.} } \value{ -none +A data table with columns for time, incidence, age group, risk group, social group, model type, and state name. } \description{ -function to conver the incidence matrix from a state run to a data.frame +This function processes the states of a given object and returns a data table with detailed information about each state. +} +\details{ +The function generates a list of state names and categorizes them into risk groups, social groups, and model types. It then runs the state function on the input object and processes the resulting states into a data frame. The data frame is then transformed into a long format and additional columns are added to provide detailed information about each state. } diff --git a/man/compare_interventions.Rd b/man/compare_interventions.Rd new file mode 100644 index 0000000..219650d --- /dev/null +++ b/man/compare_interventions.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{compare_interventions} +\alias{compare_interventions} +\title{Compare Interventions} +\usage{ +compare_interventions(obj_base, obj_inter) +} +\arguments{ +\item{obj_base}{An object containing the outcomes of the base intervention.} + +\item{obj_inter}{A list of objects, each containing the outcomes of different interventions to be compared with the base intervention.} +} +\value{ +A data frame summarizing the total cases, cases in very high-risk (VHR) groups, and total cases for each age group and outcome, for both the base and other interventions. +} +\description{ +This function compares the outcomes of a base intervention with multiple other interventions. +} diff --git a/man/convert_efficacies.Rd b/man/convert_efficacies.Rd new file mode 100644 index 0000000..180214c --- /dev/null +++ b/man/convert_efficacies.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_programme_methods.R +\name{convert_efficacies} +\alias{convert_efficacies} +\title{Convert Immune Profile to Efficacies} +\usage{ +convert_efficacies(immune_profile) +} +\arguments{ +\item{immune_profile}{A list containing immune profile information. It should have the following structure: +\describe{ +\item{vhr}{A list with element \code{b} representing the efficacy for very high risk (VHR) individuals.} +\item{mass}{A list with elements \code{b} and \code{product} representing the efficacy and product type for mass immunization. The \code{product} can be "lav", "mab", or "mat".} +}} +} +\value{ +A list with the following elements: +\describe{ +\item{mab_vhr}{Efficacy for monoclonal antibodies (MAB) in very high risk individuals.} +\item{mab_mass}{Efficacy for monoclonal antibodies (MAB) in mass immunization.} +\item{lav_mass}{Efficacy for live attenuated vaccines (LAV) in mass immunization.} +\item{mat_mass}{Efficacy for maternal antibodies (MAT) in mass immunization.} +} +} +\description{ +This function takes an immune profile and converts it into a list of efficacies for different products. +} +\details{ +The function initializes the efficacy list with zeros. It then checks if the immune profile contains efficacy values for VHR and mass immunization and updates the efficacy list accordingly. +} +\examples{ +immune_profile <- list( + vhr = list(b = 0.8), + mass = list(b = 0.6, product = "lav") +) +convert_efficacies(immune_profile) + +} diff --git a/man/convert_mat_to_trans_cal.Rd b/man/convert_mat_to_trans_cal.Rd new file mode 100644 index 0000000..f03580a --- /dev/null +++ b/man/convert_mat_to_trans_cal.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_programme_methods.R +\name{convert_mat_to_trans_cal} +\alias{convert_mat_to_trans_cal} +\title{Convert Matrices to Transmission Calendar} +\usage{ +convert_mat_to_trans_cal( + all_dose, + all_sero, + cal_vhr, + daily_uptake_vhr, + cal, + daily_uptake, + immune_profile +) +} +\arguments{ +\item{all_dose}{A matrix representing all doses.} + +\item{all_sero}{A matrix representing all sero values.} + +\item{cal_vhr}{A calendar matrix for very high risk (VHR) individuals.} + +\item{daily_uptake_vhr}{A matrix representing daily uptake for VHR individuals.} + +\item{cal}{A calendar matrix for the general population.} + +\item{daily_uptake}{A matrix representing daily uptake for the general population.} + +\item{immune_profile}{A list containing immune profiles for VHR and general population.} +} +\value{ +A list containing updated \code{dose} and \code{sero} matrices. +} +\description{ +This function converts dose and sero matrices into a transmission calendar based on the provided immune profile. +} +\details{ +The function first creates a VHR calendar if the immune profile for VHR is not "none". It then calculates the sero and dose models using the \code{get_sero_dose_cals} helper function. The results are stored in the \code{all_sero} and \code{all_dose} matrices. + +The \code{get_sero_dose_cals} function calculates the dose and sero models based on the provided calendar, daily uptake, and immune profile. It considers different sero delays and coverage values. +} diff --git a/man/convert_to_outcomes.Rd b/man/convert_to_outcomes.Rd new file mode 100644 index 0000000..d38387e --- /dev/null +++ b/man/convert_to_outcomes.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/run_methods.R +\name{convert_to_outcomes} +\alias{convert_to_outcomes} +\title{Convert to Outcomes} +\usage{ +convert_to_outcomes(object, yrsum = 2) +} +\arguments{ +\item{object}{An object containing the necessary data for processing.} + +\item{yrsum}{An integer specifying the number of years to summarize. Default is 2.} +} +\value{ +A list containing the following elements: +\item{outcomes}{A data frame with weekly outcomes by age group.} +\item{costs}{A data frame with discounted costs by outcome and age group.} +\item{qaly}{A data frame with discounted quality-adjusted life years (QALYs) by outcome and age group.} +\item{doses}{A vector containing the number of doses administered.} +} +\description{ +This function processes an object to calculate various health outcomes over time. +} +\details{ +The function performs the following steps: +\enumerate{ +\item Extracts necessary data from the input object. +\item Calculates the proportion of individuals in different states over time. +\item Estimates the incidence of various health outcomes for vaccinated and unvaccinated groups. +\item Computes the protected incidence for different health outcomes. +\item Aggregates the results to provide weekly outcomes, costs, and QALYs by age group. +\item Applies discounting to costs and QALYs. +} +} +\examples{ +\dontrun{ +result <- convert_to_outcomes(my_object, yrsum = 3) +} +} diff --git a/man/covert_raw_to_risk.Rd b/man/covert_raw_to_risk.Rd new file mode 100644 index 0000000..d1f4f91 --- /dev/null +++ b/man/covert_raw_to_risk.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_economics_methods.R +\name{covert_raw_to_risk} +\alias{covert_raw_to_risk} +\title{Convert Raw Outcomes to Risk} +\usage{ +covert_raw_to_risk(object, outcomes_raw, model_cases_sample_mean) +} +\arguments{ +\item{object}{An object containing UK population data.} + +\item{outcomes_raw}{A data frame containing raw outcome data.} + +\item{model_cases_sample_mean}{A data frame containing model cases sample mean.} +} +\value{ +A data frame with calculated risk metrics for each age group and outcome. +} +\description{ +This function converts raw outcome data to risk metrics based on population data and model cases sample mean. +} +\details{ +The function performs the following steps: +\itemize{ +\item Extracts population and age group data from the input object. +\item Defines helper functions to check the completeness of data and calculate risk per infection. +\item Checks that each outcome has data for all age groups. +\item Combines raw outcomes data with model cases data and population data. +\item Calculates the risk per infection for each outcome and age group. +} +} +\examples{ +\dontrun{ + result <- covert_raw_to_risk(object, outcomes_raw, model_cases_sample_mean) + print(result) +} + +} diff --git a/man/get_averted_df.Rd b/man/get_averted_df.Rd new file mode 100644 index 0000000..f51ac30 --- /dev/null +++ b/man/get_averted_df.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{get_averted_df} +\alias{get_averted_df} +\title{Calculate Averted Cases Data Frame} +\usage{ +get_averted_df(base, interventions) +} +\arguments{ +\item{base}{A data frame containing the base scenario data with columns \code{s}, \code{outcome}, \code{age_group}, and \code{cases_total}.} + +\item{interventions}{A data frame containing the intervention scenario data with columns \code{s}, \code{outcome}, \code{age_group}, and \code{cases_total}.} +} +\value{ +A data frame with the calculated averted cases and proportions, with recoded age groups and outcomes. +} +\description{ +This function calculates the number of averted cases for different interventions compared to a base scenario. +} +\details{ +The function performs the following steps: +\itemize{ +\item Joins the base and intervention data frames on \code{s}, \code{outcome}, and \code{age_group}. +\item Calculates the total number of cases averted and the proportion of cases averted. +\item Recodes the age groups and outcomes to more descriptive labels. +\item Converts the recoded age groups and outcomes to factors with specific levels. +} +} +\examples{ +\dontrun{ +base <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(100, 200, 150, 120, 130)) +interventions <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(90, 180, 140, 110, 120)) +get_averted_df(base, interventions) +} +} diff --git a/man/get_coverage.Rd b/man/get_coverage.Rd new file mode 100644 index 0000000..68f9c13 --- /dev/null +++ b/man/get_coverage.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_programme_methods.R +\name{get_coverage} +\alias{get_coverage} +\title{Get Coverage} +\usage{ +get_coverage(immune_profile_mass, cal) +} +\arguments{ +\item{immune_profile_mass}{A data frame containing the immune profile mass information.} + +\item{cal}{A data frame containing the calibration data.} +} +\value{ +The coverage value. If the product in the immune profile mass is "mat", it returns the mean of the positive coverage values from the calibration data. Otherwise, it returns 0. +} +\description{ +This function calculates the coverage based on the immune profile mass and calibration data. +} +\examples{ +immune_profile_mass <- data.frame(product = "mat") +cal <- data.frame(cov = c(0.1, 0.2, 0, -0.1)) +get_coverage(immune_profile_mass, cal) +} diff --git a/man/get_daily_uptake.Rd b/man/get_daily_uptake.Rd index 02a8d31..7eb3ccc 100644 --- a/man/get_daily_uptake.Rd +++ b/man/get_daily_uptake.Rd @@ -2,18 +2,28 @@ % Please edit documentation in R/add_programme_methods.R \name{get_daily_uptake} \alias{get_daily_uptake} -\title{Function to convert a custom weekly uptake vector into a daily uptake calendar} +\title{Calculate Daily Uptake from Weekly Data} \usage{ get_daily_uptake(up_week_raw, start_time) } \arguments{ -\item{up_week_raw}{A vector of weekly uptake proportions} +\item{up_week_raw}{A numeric vector containing the weekly uptake data.} -\item{start_time}{Start week when administration occurs} +\item{start_time}{An integer representing the start time in days.} } \value{ -A vector of the daily proportion of a target group which are vaccinated. +A numeric vector of length 365 representing the daily uptake. } \description{ -Function to convert a custom weekly uptake vector into a daily uptake calendar +This function calculates the daily uptake based on weekly uptake data. +} +\details{ +The function first processes the weekly data to fill a weekly uptake vector, then calculates the daily uptake by interpolating the weekly data. +} +\examples{ +\dontrun{ +up_week_raw <- c(0.1, 0.2, 0.3, 0.4, 0.5) +start_time <- 1 +daily_uptake <- get_daily_uptake(up_week_raw, start_time) +} } diff --git a/man/get_efficacies_sample.Rd b/man/get_efficacies_sample.Rd new file mode 100644 index 0000000..183dba4 --- /dev/null +++ b/man/get_efficacies_sample.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/run_methods.R +\name{get_efficacies_sample} +\alias{get_efficacies_sample} +\title{Get Efficacies Sample} +\usage{ +get_efficacies_sample(object, seed) +} +\arguments{ +\item{object}{An object containing efficacies in a list format.} + +\item{seed}{An integer representing the seed to select the sample from the efficacies.} +} +\value{ +A list containing the sampled efficacies for each efficacy type. +} +\description{ +This function retrieves a sample of efficacies from an object based on a provided seed. +} +\details{ +The function initializes a list with efficacy types set to 0. It then iterates over the names of the efficacy types and checks if the length of the efficacy values for each type is greater than 1. If so, it selects the efficacy value based on the provided seed. Otherwise, it assigns the single efficacy value to the list. The function finally returns the list of sampled efficacies. +} +\examples{ +\dontrun{ +object <- list(efficacies = list(mab_vhr = c(0.1, 0.2), mab_mass = 0.3, lav_mass = c(0.4, 0.5), mat_mass = 0.6)) +seed <- 1 +get_efficacies_sample(object, seed) +} +} diff --git a/man/output_samples.Rd b/man/output_samples.Rd index 7806e06..c999b88 100644 --- a/man/output_samples.Rd +++ b/man/output_samples.Rd @@ -2,15 +2,37 @@ % Please edit documentation in R/add_economics_methods.R \name{output_samples} \alias{output_samples} -\title{Convert mean and ci into samples from a fitted distribution} +\title{Generate and output samples for economic and risk data} \usage{ output_samples(econ_raw, risks_raw, file.name) } \arguments{ -\item{econ_raw}{a dataframe with the economic parameters per age group.} +\item{econ_raw}{A data frame containing raw economic data with columns for age group, outcome, reference QALYs, mean QALYs, lower bound QALYs, and upper bound QALYs.} -\item{risks_raw}{a dataframe with the risk of outcomes per age group.} +\item{risks_raw}{A data frame containing raw risk data.} + +\item{file.name}{A string specifying the name of the output file.} +} +\value{ +A list containing sampled outcomes for risks, QALYs, and costs. } \description{ -Convert mean and ci into samples from a fitted distribution. +This function processes raw economic and risk data, fits distributions to the data, +generates samples, and outputs the results to a specified file. +} +\details{ +The function performs the following steps: +\itemize{ +\item Fits triangular distributions to the risk, QALY, and cost data. +\item Generates samples for each outcome using the fitted distributions. +\item Outputs the sampled outcomes to the specified file. +} +} +\examples{ +\dontrun{ +econ_raw <- read.csv("economic_data.csv") +risks_raw <- read.csv("risk_data.csv") +output_samples(econ_raw, risks_raw, "output_samples.csv") +} + } diff --git a/man/plot_calendar.Rd b/man/plot_calendar.Rd index 03d2fd5..38cb6d3 100644 --- a/man/plot_calendar.Rd +++ b/man/plot_calendar.Rd @@ -2,16 +2,32 @@ % Please edit documentation in R/add_programme_methods.R \name{plot_calendar} \alias{plot_calendar} -\title{function to plot the dosing calendar of the RSVprogramme]} +\title{Plot Dosing Calendar} \usage{ plot_calendar(object) } \arguments{ -\item{object}{an RSVProgramme object} +\item{object}{An object containing the dosing calendar and other relevant data.} } \value{ -none +None } \description{ -function to plot the dosing calendar of the RSVprogramme] +This function generates and saves a plot of the dosing calendar for different age groups. +} +\details{ +The function performs the following steps: +\itemize{ +\item Checks if the directory for saving the plot exists, and creates it if it does not. +\item Extracts unique age groups from the economic data frame within the object. +\item Updates the column names of the dose calendar matrices to match the age groups. +\item Converts the dose calendar matrices into a data frame suitable for plotting. +\item Generates a ggplot of the dosing calendar, with days of the year on the x-axis, age groups on the y-axis, and the proportion of doses as the fill color. +\item Saves the plot as a PNG file in the specified directory. +} +} +\examples{ +\dontrun{ +plot_calendar(my_object) +} } diff --git a/man/plot_economics.Rd b/man/plot_economics.Rd new file mode 100644 index 0000000..5220e26 --- /dev/null +++ b/man/plot_economics.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_economics_methods.R +\name{plot_economics} +\alias{plot_economics} +\title{Plot Economics Data} +\usage{ +plot_economics(object) +} +\arguments{ +\item{object}{An object containing economic data frames (\code{econ_df}, \code{risks_df}, \code{risks_vhr_df}) and an economic name (\code{econ_name}).} +} +\description{ +This function generates and saves plots for economic data, risks data, and very high-risk data from the given object. +} +\details{ +The function performs the following steps: +\itemize{ +\item Checks if the directory for saving plots exists, and creates it if it does not. +\item Processes the economic data frame (\code{econ_df}) to create a combined data frame for QALY loss and Costs. +\item Generates and saves a plot for the economic data with uncertainty ribbons and lines. +\item Generates and saves a plot for the risks data with uncertainty ribbons and lines. +\item Generates and saves a plot for the very high-risk data with lines. +} +} diff --git a/man/plot_economics_fit.Rd b/man/plot_economics_fit.Rd new file mode 100644 index 0000000..7d6ea8e --- /dev/null +++ b/man/plot_economics_fit.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_economics_methods.R +\name{plot_economics_fit} +\alias{plot_economics_fit} +\title{Plot Economic Fit} +\usage{ +plot_economics_fit(object) +} +\arguments{ +\item{object}{An S4 object containing economic data and model outcomes.} +} +\value{ +None. The function saves the generated plots to the specified directory. +} +\description{ +This function generates and saves plots comparing fitted distributions to reference data for risks, QALYs, and costs across different age groups. +} +\details{ +The function performs the following steps: +\itemize{ +\item Checks if the directory for saving plots exists, and creates it if it doesn't. +\item Extracts unique age groups from the economic data. +\item Defines a helper function to extract mean and 95\% uncertainty intervals for model outcomes. +\item Extracts fitted model outcomes for risks, QALYs, and costs. +\item Prepares data frames for risks, QALYs, and costs by merging reference data with fitted model outcomes. +\item Defines a helper function to convert data frames to long format for plotting. +\item Converts the prepared data frames to long format. +\item Generates and saves plots comparing fitted model outcomes to reference data for risks, QALYs, and costs. +} +} +\examples{ +\dontrun{ + plot_economics_fit(my_economic_model) +} +} diff --git a/man/plot_outcomes.Rd b/man/plot_outcomes.Rd new file mode 100644 index 0000000..46ae75d --- /dev/null +++ b/man/plot_outcomes.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/run_methods.R +\name{plot_outcomes} +\alias{plot_outcomes} +\title{Plot Outcomes} +\usage{ +plot_outcomes(object) +} +\arguments{ +\item{object}{An S4 object that contains the program name and outcomes data.} +} +\value{ +A ggplot object representing the boxplot of costs and QALY outcomes. +} +\description{ +This function loads the run outputs from a specified file, extracts the outcomes data, and creates a boxplot of costs and QALY (Quality-Adjusted Life Year) outcomes. The plot is saved as a PNG file. +} +\details{ +The function performs the following steps: +\itemize{ +\item Loads the run outputs from a file located in the "outputs" directory. +\item Extracts the outcomes data from the loaded object. +\item Binds the costs and QALY data into a single data frame. +\item Creates a boxplot of the costs and QALY data using ggplot2. +\item Saves the plot as a PNG file in the "figs" subdirectory of the "outputs" directory. +} +} diff --git a/man/run-RSVProgramme-method.Rd b/man/run-RSVProgramme-method.Rd index 3cfce8a..2360271 100644 --- a/man/run-RSVProgramme-method.Rd +++ b/man/run-RSVProgramme-method.Rd @@ -4,13 +4,16 @@ \alias{run,RSVProgramme-method} \title{A setMethod for the \code{run} function} \usage{ -\S4method{run}{RSVProgramme}(object, direct = FALSE, filename = NULL) +\S4method{run}{RSVProgramme}(object, direct = FALSE, filename = NULL, yr_num = 2) } \arguments{ -\item{object}{RSVProgramme object} -} -\value{ -An RSVProgramme object +\item{object}{The object on which the operation is performed.} + +\item{direct}{A logical value indicating whether to run the operation directly.} + +\item{filename}{An optional character string specifying the filename.} + +\item{yr_num}{An integer specifying the number of years, default is 2.#' @return An RSVProgramme object} } \description{ A setMethod for the \code{run} function diff --git a/man/run.Rd b/man/run.Rd new file mode 100644 index 0000000..710621a --- /dev/null +++ b/man/run.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/programmeClass.R +\name{run} +\alias{run} +\title{Run Method} +\usage{ +run(object, direct = FALSE, filename = NULL, yr_num = 2) +} +\arguments{ +\item{object}{The object on which the operation is performed.} + +\item{direct}{A logical value indicating whether to run the operation directly.} + +\item{filename}{An optional character string specifying the filename.} + +\item{yr_num}{An integer specifying the number of years, default is 2.} +} +\value{ +The result of the operation. +} +\description{ +Generic function to execute a specific operation. +} diff --git a/man/run_state-RSVProgramme-method.Rd b/man/run_state-RSVProgramme-method.Rd index b3fcd9e..ac9f72a 100644 --- a/man/run_state-RSVProgramme-method.Rd +++ b/man/run_state-RSVProgramme-method.Rd @@ -7,7 +7,11 @@ \S4method{run_state}{RSVProgramme}(object, S_i = 1, direct = FALSE) } \arguments{ -\item{object}{RSVProgramme object} +\item{object}{An object on which the state is to be run.} + +\item{S_i}{An integer representing the state index. Default is 1.} + +\item{direct}{A logical value indicating whether to run the state directly. Default is FALSE.} } \value{ a matrix with all the values of the state variables in the dynamic transmission model diff --git a/man/run_state.Rd b/man/run_state.Rd new file mode 100644 index 0000000..59dc6e9 --- /dev/null +++ b/man/run_state.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/programmeClass.R +\name{run_state} +\alias{run_state} +\title{Run State Generic Function} +\usage{ +run_state(object, S_i = 1, direct = FALSE) +} +\arguments{ +\item{object}{An object on which the state is to be run.} + +\item{S_i}{An integer representing the state index. Default is 1.} + +\item{direct}{A logical value indicating whether to run the state directly. Default is FALSE.} +} +\value{ +The result of the state run, depending on the method implementation. +} +\description{ +This is a generic function for running a state. +} diff --git a/man/summarise_outcomes.Rd b/man/summarise_outcomes.Rd new file mode 100644 index 0000000..1314e53 --- /dev/null +++ b/man/summarise_outcomes.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{summarise_outcomes} +\alias{summarise_outcomes} +\title{Summarise Outcomes} +\usage{ +summarise_outcomes(x) +} +\arguments{ +\item{x}{An object containing the outcomes data.} +} +\value{ +A data frame with the total number of cases grouped by \code{s}, \code{outcome}, and \code{age_group}. +} +\description{ +This function takes an object \code{x} and summarises the outcomes by grouping +by \code{s}, \code{outcome}, and \code{age_group}, then calculates the total number of cases. +} diff --git a/tests/testthat.R b/old_tests/testthat.R similarity index 100% rename from tests/testthat.R rename to old_tests/testthat.R diff --git a/tests/testthat/test_statevars.R b/old_tests/testthat/test_statevars.R similarity index 100% rename from tests/testthat/test_statevars.R rename to old_tests/testthat/test_statevars.R diff --git a/outputs/E_W2023/figs/compare_fit_costs.png b/outputs/E_W2023/figs/compare_fit_costs.png index 36ee49b..f5b13bc 100644 Binary files a/outputs/E_W2023/figs/compare_fit_costs.png and b/outputs/E_W2023/figs/compare_fit_costs.png differ diff --git a/outputs/E_W2023/figs/compare_fit_qalys.png b/outputs/E_W2023/figs/compare_fit_qalys.png index ca802dc..6de9d0b 100644 Binary files a/outputs/E_W2023/figs/compare_fit_qalys.png and b/outputs/E_W2023/figs/compare_fit_qalys.png differ diff --git a/outputs/E_W2023/figs/compare_fit_risks.png b/outputs/E_W2023/figs/compare_fit_risks.png index 63e2e90..8a64816 100644 Binary files a/outputs/E_W2023/figs/compare_fit_risks.png and b/outputs/E_W2023/figs/compare_fit_risks.png differ diff --git a/outputs/E_W2023/figs/economics_raw_uncertainty.png b/outputs/E_W2023/figs/economics_raw_uncertainty.png index c5d724d..f313288 100644 Binary files a/outputs/E_W2023/figs/economics_raw_uncertainty.png and b/outputs/E_W2023/figs/economics_raw_uncertainty.png differ diff --git a/outputs/E_W2023/figs/risks_raw_uncertainty.png b/outputs/E_W2023/figs/risks_raw_uncertainty.png index 62807e3..3885f67 100644 Binary files a/outputs/E_W2023/figs/risks_raw_uncertainty.png and b/outputs/E_W2023/figs/risks_raw_uncertainty.png differ diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 1322488..0000000 Binary files a/src/.DS_Store and /dev/null differ diff --git a/src/RcppExports.o b/src/RcppExports.o deleted file mode 100644 index cefae85..0000000 Binary files a/src/RcppExports.o and /dev/null differ diff --git a/src/RunInterventions.o b/src/RunInterventions.o deleted file mode 100644 index 134d32f..0000000 Binary files a/src/RunInterventions.o and /dev/null differ diff --git a/src/ascent/.DS_Store b/src/ascent/.DS_Store deleted file mode 100644 index 92c63bd..0000000 Binary files a/src/ascent/.DS_Store and /dev/null differ diff --git a/src/rsvie.so b/src/rsvie.so deleted file mode 100755 index cfb0b72..0000000 Binary files a/src/rsvie.so and /dev/null differ diff --git a/vignettes/sanity_check_base.Rmd b/vig_working/sanity_checks/sanity_check_base.Rmd similarity index 100% rename from vignettes/sanity_check_base.Rmd rename to vig_working/sanity_checks/sanity_check_base.Rmd diff --git a/vignettes/sanity_check_lav.Rmd b/vig_working/sanity_checks/sanity_check_lav.Rmd similarity index 100% rename from vignettes/sanity_check_lav.Rmd rename to vig_working/sanity_checks/sanity_check_lav.Rmd diff --git a/vignettes/sanity_check_mabs.Rmd b/vig_working/sanity_checks/sanity_check_mabs.Rmd similarity index 100% rename from vignettes/sanity_check_mabs.Rmd rename to vig_working/sanity_checks/sanity_check_mabs.Rmd diff --git a/vignettes/sanity_check_mat.Rmd b/vig_working/sanity_checks/sanity_check_mat.Rmd similarity index 100% rename from vignettes/sanity_check_mat.Rmd rename to vig_working/sanity_checks/sanity_check_mat.Rmd diff --git a/vignettes/sanity_check_vhr.Rmd b/vig_working/sanity_checks/sanity_check_vhr.Rmd similarity index 100% rename from vignettes/sanity_check_vhr.Rmd rename to vig_working/sanity_checks/sanity_check_vhr.Rmd diff --git a/vignettes/.DS_Store b/vignettes/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/vignettes/.DS_Store and /dev/null differ diff --git a/vignettes/example.Rmd b/vignettes/example.Rmd deleted file mode 100644 index f0672e1..0000000 --- a/vignettes/example.Rmd +++ /dev/null @@ -1,176 +0,0 @@ -# Markdown explaining how to use the RSV impact package -## Load the packages - - -```{r} - -# Load the package (or library(rsvie)) -devtools::load_all() - -# This defines an RSVProgramme class -RSVempty <- make_rsv_programme() - -# To see what is in these slots -RSVempty %>% str - -``` - -Let's have a more detailed look at what's in these slots. I wouldn't recommend changing them, but future package iterations should allow for more flexibility. - -```{r} - -RSVempty@prog_name # Name of the programme considered (currently empty) -RSVempty@econ_name # Name of the economics considered (currently empty) -RSVempty@uk_data # UK-specific parameters which are used to define the model (RSVempty@model is copied from this) -RSVempty@model # This is the R interface to the cpp class defined in src/RunIntervention.cpp -RSVempty@model_par # This gives the burn-in and run_yrs (how long the model is run for after bur-in). -RSVempty@econ_par # Parameters associated with the economics of the model, time_horizon is currently set to 10 years, and the discount rate is 3.5% -RSVempty@post # Posterior distributions fitted to UK-specific data -RSVempty@uk_data$populationAgeGroup # Posterior distributions fitted to UK-specific data - -``` - -## Add economics - -With this empty class, we now add information on the economics of the model. This includes the health outcomes considered, the risk of each health outcome occurring per infection, and the QALY loss and cost of each outcome. -First, we define the risk of each health outcome per age group: - -```{r} - -# The risk of health outcome per infection can be difficult to obtain from the literature. However, we can aggregate different burden estimates into -# a spreadsheet and convert them. For example, take the outcomes_incidence.csv included with the package. This has different -# types of incidence estimates: - -outcomes_incidence <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcomes_incidence.csv")) - -# `outcomes_incidence` includes the incidence of each outcome per age group. This can be done by rates of incidence per 100,000 infected individuals -# (`inc_inf` in the metric column), or rates of incidence per 100,000 individuals (inc in the metric column), or the absolute number of cases per year ('n' in the metric column). -# The user can copy this Excel spreadsheet and change the incidences according to their beliefs. - -# To estimate the risk per infection of each outcome, we need to load the model-predicted number of cases and -# covert `inc` and `n` to `inc_inf`: - -# This loads the model-predicted incidence in each age group -model_cases_sample_mean_get <- load(file = system.file(package = "rsvie", "extdata", "model_cases_sample_mean.RData")) -model_cases_sample_mean <- get(model_cases_sample_mean_get) - -# This function then converts `outcomes_incidence` to the risk per infection of each outcome -risks_raw <- covert_raw_to_risk(RSVempty, outcomes_incidence, model_cases_sample_mean) - -# For Palivizumab risks, we have a preloaded package from literature -risks_vhr_raw <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcome_risks_vhr.csv")) - -``` - -Now, we need to load the QALY loss and cost for each outcome per age group. - -```{r} - -# Similar to before, we load an Excel spreadsheet with all this information -econ_raw <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "econ_pars.csv")) - -# For QALY, we have the QALY loss per outcome per age group with the mean and confidence intervals if available -# For cost, we have the cost per outcome per age group with mean and confidence intervals if available. -# The user can copy this Excel spreadsheet and change the QALY loss and costs according to their beliefs. - -``` - -Finally, we take the estimated risks and economics and add these to the class. - -```{r} - -RSVempty <- add_economics(RSVempty, econ_name = "E_W2023", econ_raw, risks_raw, risks_vhr_raw) - -# We can check the slots to make sure these have been added properly -RSVempty@risks_df -RSVempty@econ_df -RSVempty@outcomes_vec # vector of outcomes considered - -# Note: To help with sampling times, the model fits a triangular distribution to each risk and economic outcome and samples 1000 values. -# These values can be seen here -RSVempty@samples_outcomes - -# You can also make some plots by calling: -plot_economics(RSVempty) -plot_economics_fit(RSVempty) - -``` - - -## Add intervention programmes - -With the economics and risks defined, we can now define an intervention programme. We have several vignettes showing how to evaluate various types of programmes that use different products. Here is a simple example: - -```{r} - -# To evaluate a seasonal monoclonal given at birth, we load an Excel spreadsheet such as: -cal_mabs_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_mabs_s.csv")) - -# In this spreadsheet you can define the start and end date for each age group and the coverage. Note the year doesn't matter, but if you -# wish to evaluate over a seasonal from Dec -> Jan, the year must increase by 1 -# The uptake is defined as linear, which means through the administration window, it is given uniformly. This is appropriate for a product given at birth -# other options are available for different programmes, e.g. older adults, where uptake is higher at the start of the season. See `*_lav` vignette. - -``` - -We must also define the immunological profile of the product we are evaluating. To do this, we define a list with two entries -* `mass`, defines the immunological profile for the mass administration product -* `vhr`, defines the immunological profile for the palivizumab programme -* `disease_eff`, if efficacy changes for different outcomes, the values can be given here, and the outputs will be adjusted accordingly. - -For `mass` and `vhr`, we define a list with the following options: - -* `product`, name of the product evaluated. This can be `mat` for maternal programme, `mab` for long-acting monoclonal antibodies, or `lav` for live active vaccine (older adults) -* `wane function`, defined as "a * exp(b * t)", currently, this doesn't do anything, but in future iterations, this will allow the user to define different options. The default assumption on waning is Erlang-3. -* `a` is the proportion of vaccinated infants that move to the protected group -* `b` is the rate at which people lose immunity between each of the three vaccinated compartments -* `sero_delay` the delay between vaccination and acquiring immunity (instant for mabs) - -An example of mabs is given below: - -```{r} - -immune_profile_lav_unbound <- list( - mass = list( - product = "lav", - wane_function = "a * exp(b * t))", a = oa_papi_nobound_wane$wane_a_er3, b = 1/oa_papi_nobound_wane$wane_b_er3, - sero_delay = "none" - ), - vhr = list( - product = "pal", - wane_function = "a * exp(b * t))", a = 0.7, b = 1 / 60, - sero_delay = "none" - ), - disease_eff = disease_eff_values, - direct = FALSE -) - - -``` - -How do we know `a` and `b` in the immunological definitions? We used a Bayesian model fit defined in the package ``, with more details in the SI of the paper. -We emphasise that the immune waning follows a Erlang-3 distribution. In future developments of this package we will add other options. For now, we recommend using the default options for immune waning defined in the package. - -We can then add the immunological profile and intervention programme to the class, which has its economics defined, by the function: - -```{r} - -RSV_mab_s <- add_programme(RSVempty, prog_name = "mab_s", cal_mabs_s, cal_vhr_s, immune_profile_mab) - -# RSV_mab_s an RSVPrograme class object -# prog_name gives the programme a name - -``` - - -## Simulate the intervention programme - -To simulate a programme, we run: - -```{r} - -RSV_mab_s <- rsvie::run(RSV_mab_s) - -# RSV_mab_s still RSVPrograme class object, with all the outcomes ready for post-processing - -``` \ No newline at end of file diff --git a/vignettes/example_mab.Rmd b/vignettes/example_mab.Rmd new file mode 100644 index 0000000..a6c81b0 --- /dev/null +++ b/vignettes/example_mab.Rmd @@ -0,0 +1,122 @@ +--- +title: "Evaluating RSV monoclonal antibody programmes" +author: "David Hodgson" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Evaluating RSV monoclonal antibody programmes} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +# Markdown explaining how to use the RSV impact evaluation `rsvie` package + +## 1. Load package and functions +This vignette explains how to use the `rsvie` package to evaluate the impact of different RSV intervention programmes. The package is designed to be flexible and allow the user to define different intervention programmes, with different immunological profiles, and evaluate their impact on RSV outcomes. + + +```{r, load libraries, echo=FALSE, results='hide'} + +# Load the package (or library(rsvie)) +devtools::load_all() + +# This defines an RSVPrograpkmme class +RSVempty <- make_rsv_programme(1) + +# To see what is in these slots +RSVempty %>% str + +``` + +Let's have a more detailed look at what's in these slots. I wouldn't recommend changing them, but future package iterations should allow for more flexibility. + +```{r check, echo=FALSE, results='hide'} + +RSVempty@prog_name # Name of the programme considered (currently empty) +RSVempty@econ_name # Name of the economics considered (currently empty) +RSVempty@uk_data # UK-specific parameters which are used to define the model (RSVempty@model is copied from this) +RSVempty@model # This is the R interface to the cpp class defined in src/RunIntervention.cpp +RSVempty@model_par # This gives the burn-in and run_yrs (how long the model is run for after bur-in). +RSVempty@econ_par # Parameters associated with the economics of the model, time_horizon is currently set to 10 years, and the discount rate is 3.5% +RSVempty@post # Posterior distributions fitted to UK-specific data +RSVempty@uk_data$populationAgeGroup # Posterior distributions fitted to UK-specific data + +``` + +## 2. Add estimate pre-vaccination burden and risks of the programme + +With this empty class, we now add information on the economics of the model. This includes the health outcomes considered, the risk of each health outcome occurring per infection, and the QALY loss and cost of each outcome. +First, we define the risk of each health outcome per age group: + +```{r incidence, echo=FALSE, results='hide'} + +econ_raw_ss <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "econ_pars_ss.csv")) +risks_vhr_raw <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcome_risks_vhr.csv")) + +outcomes_incidence <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcomes_incidence.csv")) +model_cases_sample_mean_get <- load(file = system.file(package = "rsvie", "extdata", "model_cases_sample_mean.RData")) +model_cases_sample_mean <- get(model_cases_sample_mean_get) + +# This function then converts the incidence of the outcome to the risk per infection +risks_raw <- covert_raw_to_risk(RSVempty, outcomes_incidence, model_cases_sample_mean) + +RSVempty_ss <- add_economics(RSVempty, econ_name = "E_W2023", econ_raw_ss, risks_raw, risks_vhr_raw) + +``` + +## 3. Add in immunology + +Now, we need to load the QALY loss and cost for each outcome per age group. + +```{r risks, echo=FALSE, results='hide'} + +immune_profile <- readRDS(file = system.file(package = "rsvie", "extdata", "efficacies", "immune_profiles_unbound.RDS")) + +``` + + +## 4. Add intervention programmes + +With the economics and risks defined, we can now define an intervention programme. We have several vignettes showing how to evaluate various types of programmes that use different products. Here is a simple example: + +```{r calendars, echo=FALSE, results='hide'} + +# To evaluate a seasonal monoclonal given at birth, we load an Excel spreadsheet such as: +cal_none <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_none.csv")) +cal_vhr_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_vhr_s.csv")) +cal_mabs_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_mabs_s.csv")) + +RSV_mab_vhr <- add_programme(RSVempty_ss, prog_name = "pal", cal_none, cal_vhr_s, immune_profile$mabs_vhr) +RSV_mab_s <- add_programme(RSVempty_ss, prog_name = "mab_s", cal_mabs_s, cal_vhr_s, immune_profile$mabs) + + +``` + + + +## 5. Simulate the intervention programme + +To simulate a programme, we call `rsvie::run` on the class defined above. This will simulate the programme and return a class with the results. + +```{r run, echo=FALSE, results='hide'} + +# base vase +RSV_mab_vhr <- rsvie::run(RSV_mab_vhr) +# seasonal +RSV_mab_s <- rsvie::run(RSV_mab_s) + +``` + +## 6. Extract incidence for further exploration + +```{r post-process, echo=FALSE, results='hide'} + +# Look at full posterior outcomes + +# summari outcomes annually +RSV_mab_vhr_sum <- summarise_outcomes(RSV_mab_vhr) +RSV_mab_s_sum <- summarise_outcomes(RSV_mab_s) + +get_averted_df(RSV_mab_vhr_sum, RSV_mab_s_sum) + +``` \ No newline at end of file diff --git a/vignettes/example_mat.Rmd b/vignettes/example_mat.Rmd new file mode 100644 index 0000000..032bfd8 --- /dev/null +++ b/vignettes/example_mat.Rmd @@ -0,0 +1,123 @@ +--- +title: "Evaluating RSV maternal vaccination programmes" +author: "David Hodgson" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Evaluating RSV maternal vaccination programmes} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +# Markdown explaining how to use the RSV impact evaluation `rsvie` package + +## 1. Load package and functions +This vignette explains how to use the `rsvie` package to evaluate the impact of different RSV intervention programmes. The package is designed to be flexible and allow the user to define different intervention programmes, with different immunological profiles, and evaluate their impact on RSV outcomes. + + +```{r, load libraries, echo=FALSE, results='hide'} + +# Load the package (or library(rsvie)) +devtools::load_all() + +# This defines an RSVProgramme class +RSVempty <- make_rsv_programme(1) + +# To see what is in these slots +RSVempty %>% str + +``` + +Let's have a more detailed look at what's in these slots. I wouldn't recommend changing them, but future package iterations should allow for more flexibility. + +```{r check, echo=FALSE, results='hide'} + +RSVempty@prog_name # Name of the programme considered (currently empty) +RSVempty@econ_name # Name of the economics considered (currently empty) +RSVempty@uk_data # UK-specific parameters which are used to define the model (RSVempty@model is copied from this) +RSVempty@model # This is the R interface to the cpp class defined in src/RunIntervention.cpp +RSVempty@model_par # This gives the burn-in and run_yrs (how long the model is run for after bur-in). +RSVempty@econ_par # Parameters associated with the economics of the model, time_horizon is currently set to 10 years, and the discount rate is 3.5% +RSVempty@post # Posterior distributions fitted to UK-specific data +RSVempty@uk_data$populationAgeGroup # Posterior distributions fitted to UK-specific data + +``` + +## 2. Add estimate pre-vaccination burden and risks of the programme + +With this empty class, we now add information on the economics of the model. This includes the health outcomes considered, the risk of each health outcome occurring per infection, and the QALY loss and cost of each outcome. +First, we define the risk of each health outcome per age group: + +```{r incidence, echo=FALSE, results='hide'} + +econ_raw_ss <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "econ_pars_ss.csv")) +risks_vhr_raw <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcome_risks_vhr.csv")) + +outcomes_incidence <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcomes_incidence.csv")) +model_cases_sample_mean_get <- load(file = system.file(package = "rsvie", "extdata", "model_cases_sample_mean.RData")) +model_cases_sample_mean <- get(model_cases_sample_mean_get) + +# This function then converts the incidence of the outcome to the risk per infection +risks_raw <- covert_raw_to_risk(RSVempty, outcomes_incidence, model_cases_sample_mean) + +RSVempty_ss <- add_economics(RSVempty, econ_name = "E_W2023", econ_raw_ss, risks_raw, risks_vhr_raw) + +``` + +## 3. Add in immunology + +Now, we need to load the QALY loss and cost for each outcome per age group. + +```{r risks, echo=FALSE, results='hide'} + +immune_profile <- readRDS(file = system.file(package = "rsvie", "extdata", "efficacies", "immune_profiles_unbound.RDS")) + +``` + + +## 4. Add intervention programmes + +With the economics and risks defined, we can now define an intervention programme. We have several vignettes showing how to evaluate various types of programmes that use different products. Here is a simple example: + +```{r calendars, echo=FALSE, results='hide'} + +# To evaluate a seasonal monoclonal given at birth, we load an Excel spreadsheet such as: +cal_none <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_mat_none.csv")) +cal_vhr_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_vhr_s.csv")) +cal_mat_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_mat_s.csv")) + +RSV_mat_vhr <- add_programme(RSVempty_ss, prog_name = "pal", cal_none, cal_vhr_s, immune_profile$mat_vhr) +RSV_mat_s <- add_programme(RSVempty_ss, prog_name = "mat_s", cal_mat_s, cal_vhr_s, immune_profile$mat) + + +``` + + + +## 5. Simulate the intervention programme + +To simulate a programme, we call `rsvie::run` on the class defined above. This will simulate the programme and return a class with the results. + +```{r run, echo=FALSE, results='hide'} + +# base vase +RSV_mat_vhr <- rsvie::run(RSV_mat_vhr) +# seasonal +RSV_mat_s <- rsvie::run(RSV_mat_s) + +``` + +## 6. Extract incidence for further exploration + +```{r post-process, echo=FALSE, results='hide'} + +# Look at full posterior outcomes +RSV_mat_s@outcomes$outcomes + +# summari outcomes annually +RSV_mat_vhr_sum <- summarise_outcomes(RSV_mat_vhr) +RSV_mat_s_sum <- summarise_outcomes(RSV_mat_s) + +get_averted_df(RSV_mat_vhr_sum, RSV_mat_s_sum) + +``` \ No newline at end of file diff --git a/vignettes/example_oa.Rmd b/vignettes/example_oa.Rmd new file mode 100644 index 0000000..fbfdb26 --- /dev/null +++ b/vignettes/example_oa.Rmd @@ -0,0 +1,123 @@ +--- +title: "Evaluating RSV older adult vaccination programmes" +author: "David Hodgson" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Evaluating RSV older adult vaccination programmes} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +# Markdown explaining how to use the RSV impact evaluation `rsvie` package + +## 1. Load package and functions +This vignette explains how to use the `rsvie` package to evaluate the impact of different RSV intervention programmes. The package is designed to be flexible and allow the user to define different intervention programmes, with different immunological profiles, and evaluate their impact on RSV outcomes. + + +```{r, load libraries, echo=FALSE, results='hide'} + +# Load the package (or library(rsvie)) +devtools::load_all() + +# This defines an RSVProgramme class +RSVempty <- make_rsv_programme(1) + +# To see what is in these slots +RSVempty %>% str + +``` + +Let's have a more detailed look at what's in these slots. I wouldn't recommend changing them, but future package iterations should allow for more flexibility. + +```{r check, echo=FALSE, results='hide'} + +RSVempty@prog_name # Name of the programme considered (currently empty) +RSVempty@econ_name # Name of the economics considered (currently empty) +RSVempty@uk_data # UK-specific parameters which are used to define the model (RSVempty@model is copied from this) +RSVempty@model # This is the R interface to the cpp class defined in src/RunIntervention.cpp +RSVempty@model_par # This gives the burn-in and run_yrs (how long the model is run for after bur-in). +RSVempty@econ_par # Parameters associated with the economics of the model, time_horizon is currently set to 10 years, and the discount rate is 3.5% +RSVempty@post # Posterior distributions fitted to UK-specific data +RSVempty@uk_data$populationAgeGroup # Posterior distributions fitted to UK-specific data + +``` + +## 2. Add estimate pre-vaccination burden and risks of the programme + +With this empty class, we now add information on the economics of the model. This includes the health outcomes considered, the risk of each health outcome occurring per infection, and the QALY loss and cost of each outcome. +First, we define the risk of each health outcome per age group: + +```{r incidence, echo=FALSE, results='hide'} + +econ_raw_ss <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "econ_pars_ss.csv")) +risks_vhr_raw <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcome_risks_vhr.csv")) + +outcomes_incidence <- read.csv(file = system.file(package = "rsvie", "extdata", "econ", "outcomes_incidence.csv")) +model_cases_sample_mean_get <- load(file = system.file(package = "rsvie", "extdata", "model_cases_sample_mean.RData")) +model_cases_sample_mean <- get(model_cases_sample_mean_get) + +# This function then converts the incidence of the outcome to the risk per infection +risks_raw <- covert_raw_to_risk(RSVempty, outcomes_incidence, model_cases_sample_mean) + +RSVempty_ss <- add_economics(RSVempty, econ_name = "E_W2023", econ_raw_ss, risks_raw, risks_vhr_raw) + +``` + +## 3. Add in immunology + +Now, we need to load the QALY loss and cost for each outcome per age group. + +```{r risks, echo=FALSE, results='hide'} + +immune_profile <- readRDS(file = system.file(package = "rsvie", "extdata", "efficacies", "immune_profiles_unbound.RDS")) + +``` + +## 4. Add intervention programmes + +With the economics and risks defined, we can now define an intervention programme. We have several vignettes showing how to evaluate various types of programmes that use different products. Here is a simple example: + +```{r calendars, echo=FALSE, results='hide'} + +# To evaluate a seasonal monoclonal given at birth, we load an Excel spreadsheet such as: +cal_none <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_none.csv")) +cal_vhr_s <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_vhr_s.csv")) +cal_lav_65 <- read.csv(file = system.file(package = "rsvie", "extdata", "calendars", "cal_lav_oa_65.csv")) + +# Add programmes to the empty class +RSV_65_vhr <- add_programme(RSVempty_ss, prog_name = "pal", cal_none, cal_vhr_s, immune_profile$mabs_vhr) +RSV_65_s <- add_programme(RSVempty_ss, prog_name = "mab_s", cal_lav_65, cal_vhr_s, immune_profile$lav) + + +``` + + +## 5. Simulate the intervention programme + +To simulate a programme, we call `rsvie::run` on the class defined above. This will simulate the programme and return a class with the results. + +```{r run, echo=FALSE, results='hide'} + +# Base-base +RSV_65_vhr <- rsvie::run(RSV_65_vhr) + +# Seasonal +RSV_65_s <- rsvie::run(RSV_65_s) + +``` + +## 6. Extract incidence for further exploration + +```{r post-process, echo=FALSE, results='hide'} + +# Look at full posterior outcomes +RSV_65_s@outcomes$outcomes + +# summari outcomes annually +RSV_65_vhr_sum <- summarise_outcomes(RSV_65_vhr) +RSV_65_s_sum <- summarise_outcomes(RSV_65_s) + +get_averted_df(RSV_65_vhr_sum, RSV_65_s_sum) + +``` \ No newline at end of file