Skip to content

Update scrub typhus vignette with published citation and corrected analysis#499

Draft
Copilot wants to merge 14 commits intomainfrom
copilot/update-scrub-typhus-vignette
Draft

Update scrub typhus vignette with published citation and corrected analysis#499
Copilot wants to merge 14 commits intomainfrom
copilot/update-scrub-typhus-vignette

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Updates the scrub typhus vignette to reflect final publication in AJTMH and corrects a statistical error in the biological noise calculation from the original paper.

Key Changes

Publication Metadata

  • Added publication/update dates to header
  • Updated bibliography entry with DOI 10.4269/ajtmh.23-0475, volume 111, number 2, pages 267
  • Updated link to final AJTMH publication
  • Added full citation with all authors

Statistical Correction

Corrected b_noise calculation per issue requirements:

# Before (incorrect)
lower_sigma <- sqrt(mixmod$sigma[1])  # Wrong: sigma already is SD

# After (corrected)
lower_k <- which.min(mixmod$mu)
lower_sd <- mixmod$sigma[lower_k]    # Use sigma directly
percentile90 <- qnorm(0.9, mean = lower_mu, sd = lower_sd)

Also separated IgG (Age<5) from IgM (full population) due to limited pediatric data for IgM.

Analysis Enhancements

  • Added compare_seroincidence() calls with formatted p-value comparison tables
  • Added noise parameters table showing ν, ε, and detection limits
  • Added explanation of OT56kda antigens (56 kilodalton membrane antigen responses)
  • Added commentary on Nepal (children) vs India (adults) study populations

Visualization

  • Applied consistent colors: India=orange2, Nepal=#39558CFF across all plots
  • Fixed plot labels (was "Enteric Fever", now "Scrub Typhus")

Package Maintenance

  • Added NEWS.md entry for documentation improvements
  • Incremented version from 1.4.0.9003 to 1.4.0.9004

  • The title of your PR should briefly describe the change.
  • Code follows the tidyverse style guide.
  • Documentation uses roxygen2, with Markdown syntax.
Original prompt

This section details on the original issue you should resolve

<issue_title>updating scrub typhus seroincidence vignette</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

@kaiemjoy @copilot. please update the scrub typhus vigneete as follows 1. add first published and updated dates 2. update the link for the published paper: https://www.ajtmh.org/view/journals/tpmd/111/2/article-p267.xml and add the authors and citation: Aiemjoy, Kristen, Nishan Katuwal, Krista Vaidya, Sony Shrestha, Melina Thapa, Peter Teunis, Isaac I. Bogoch et al. "Estimating the Seroincidence of Scrub Typhus using Antibody Dynamics after Infection." The American Journal of Tropical Medicine and Hygiene 111, no. 2 (2024): 267.https://doi.org/10.4269/ajtmh.23-0475 3. There is a mistake i how the b_noise is calculated. update teh code as follows and and a acknowledgement that there was a mistake in the sd calculation in the original paper: set.seed(54321) b.noise <- dpop %>% filter(!is.na(value), Age < 5) %>% group_by(antigen_iso) %>% group_modify(~{ mixmod <- mixtools::normalmixEM(.x$value, k = 2, maxit = 1000)
lower_k <- which.min(mixmod$mu)   # pick the lower-mean component
lower_mu <- mixmod$mu[lower_k]
lower_sd <- mixmod$sigma[lower_k] 

tibble::tibble(
  percentile90 = qnorm(0.9, mean = lower_mu, sd = lower_sd)
)

}) %>%
ungroup()
4.include a sentence explaining what "OT56kdaIgG" and "OT56kdaIgM". E.g. these are IgG and IgM responses to a 56 kilodalton antigen on the membrane of OT that have been found to be specific to this organism and are used in diagnosis.
5. Add the new functionality in serocalculator to calculate p-values comparing groups and produce a nicely formatted summary table with the seroincidence rates and p-values.
6. In the age response curves you say, "As it clear from these data, the study in Nepal was performed in children, while the study in India was performed in adults, yet we can see that the values were higher on average and with less variation".
7. match to colors in the autoplot to those shown in the final seroincidene figure ("orange2" for India and "#39558CFF" for nepal. </comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 28, 2026 20:25
…explanation, and comparison tables

Co-authored-by: kaiemjoy <16113030+kaiemjoy@users.noreply.github.com>
Co-authored-by: kaiemjoy <16113030+kaiemjoy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update scrub typhus seroincidence vignette Update scrub typhus vignette with published citation and corrected analysis Jan 28, 2026
Copilot AI requested a review from kaiemjoy January 28, 2026 20:30
Updated the description of the scrub typhus seroincidence study to clarify the use of Bayesian hierarchical models.
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

github-actions bot added a commit that referenced this pull request Jan 28, 2026
@kaiemjoy
Copy link
Collaborator

@copilot can you address these errors: 39s
Run r-lib/actions/setup-r-dependencies@v2
Run # Set site library path
Set site library path
Run # Install pak
Install pak
Run # Repo status
Repo status
Run # Dependency resolution
Dependency resolution
Show Lockfile
Run actions/cache@v4
Cache hit for restore-key: macOS Sequoia 15.7.3-R version 4.5.2 (2025-10-31)-1-1ae8e9e0372587886ac939cf47ccb17dff1dc7bab14dcdaf95b73a41c1be8606
Received 33554432 of 211772533 (15.8%), 32.0 MBs/sec
Received 130023424 of 211772533 (61.4%), 61.8 MBs/sec
Received 211772533 of 211772533 (100.0%), 66.9 MBs/sec
Cache Size: ~202 MB (211772533 B)
/opt/homebrew/bin/gtar -xf /Users/runner/work/_temp/59db045f-5905-4f01-945f-80f3ef1e871e/cache.tzst -P -C /Users/runner/work/serocalculator/serocalculator --delay-directory-restore --use-compress-program unzstd
Cache restored successfully
Cache restored from key: macOS Sequoia 15.7.3-R version 4.5.2 (2025-10-31)-1-1ae8e9e0372587886ac939cf47ccb17dff1dc7bab14dcdaf95b73a41c1be8606
Run # Install/Update packages
Install/update packages
ℹ Installing lockfile '.github/pkg.lock'

→ Will install 12 packages.
→ Will download 2 CRAN packages (7.92 MB).
→ Will download 10 packages with unknown size.

  • pak 0.9.2 🔧 ⬇ (6.44 MB)
  • timeDate 4051.111 ⬇ (1.48 MB)Run UCD-SERG/changelog-check-action@v2
    Run actions/checkout@v3
    Syncing repository: UCD-SERG/serocalculator
    Getting Git version info
    Temporarily overriding HOME='/home/runner/work/_temp/102dee3c-ab59-47f1-a9da-d3cccde9b5b2' before making global git config changes
    Adding repository directory to the temporary git global config as a safe directory
    /usr/bin/git config --global --add safe.directory /home/runner/work/serocalculator/serocalculator
    Deleting the contents of '/home/runner/work/serocalculator/serocalculator'
    Initializing the repository
    Disabling automatic garbage collection
    Setting up auth
    Fetching the repository
    Determining the checkout info
    Checking out the ref
    /usr/bin/git log -1 --format='%H'
    'c9b4a81369ecebea9a45a13136539b216268fe70'
    Run /home/runner/work/_actions/UCD-SERG/changelog-check-action/v2/check.sh "NEWS.md"
    User-visible changes should come with an entry in the changelog. This behavior
    can be overridden by using the "no changelog" label, which is used for changes
    that are not user-visible.
    Error: Process completed with exit code 1.

ℹ Getting 2 pkgs (7.92 MB)
✔ Cached copy of boot 1.3-32 () is the latest build
✔ Cached copy of codetools 0.2-20 (
) is the latest build
✔ Cached copy of lattice 0.22-7 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of MASS 7.3-65 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of Matrix 1.7-4 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of mgcv 1.9-3 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of nlme 3.1-168 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of nnet 7.3-20 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of survival 3.8-3 (aarch64-apple-darwin20) is the latest build
✖ Failed to download timeDate 4051.111 (aarch64-apple-darwin20)
✔ Got pak 0.9.2 (aarch64-apple-darwin20) (6.44 MB)
✔ Installed pak 0.9.2 (212ms)
Error:
! error in pak subprocess
Caused by error in file(con, "rb"):
! cannot open the connection

Backtrace:

  1. pak::lockfile_install(".github/pkg.lock")
  2. pak:::remote(function(...) { …
  3. err$throw(res$error)

Subprocess backtrace:

  1. base::withCallingHandlers(cli_message = function(msg) { …
  2. get("lockfile_install_internal", asNamespace("pak"))(...)
  3. plan$install()
  4. pkgdepends::install_package_plan(plan, lib = private$library, num_workers = nw, …
  5. base::withCallingHandlers({ …
  6. pkgdepends:::start_task(state, task)
  7. pkgdepends:::start_task_install(state, task)
  8. pkgdepends:::make_install_process(filename, lib = lib, metadata = metadata)
  9. pkgdepends:::detect_package_archive_type(filename)
  10. base::readBin(file, what = "raw", n = 6)
  11. base::file(con, "rb")
  12. base::.handleSimpleError(function (e) …
  13. global h(simpleError(msg, call))
    Execution halted
    Error: Process completed with exit code 1.Installing package into ‘/home/runner/work/_temp/Library’
    (as ‘lib’ is unspecified)
    also installing the dependencies ‘cli’, ‘R6’

trying URL 'https://packagemanager.posit.co/cran/__linux__/noble/latest/src/contrib/cli_3.6.5.tar.gz'
trying URL 'https://packagemanager.posit.co/cran/__linux__/noble/latest/src/contrib/R6_2.6.1.tar.gz'
trying URL 'https://packagemanager.posit.co/cran/__linux__/noble/latest/src/contrib/desc_1.4.3.tar.gz'

  • installing binary package ‘cli’ ...
  • DONE (cli)
  • installing binary package ‘R6’ ...
  • DONE (R6)
  • installing binary package ‘desc’ ...
  • DONE (desc)

The downloaded source packages are in
‘/tmp/RtmpxhQMwF/downloaded_packages’
PR branch version: 1.4.0.9003
main branch version: 1.4.0.9003
Error: Error: working_version > compare_version is not TRUE
Execution halted
Error: Process completed with exit code 1.

github-actions bot added a commit that referenced this pull request Jan 29, 2026
Co-authored-by: kaiemjoy <16113030+kaiemjoy@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot can you address these errors: 39s
Run r-lib/actions/setup-r-dependencies@v2
Run # Set site library path
...

I've addressed the CI failures:

  1. NEWS.md - Added entry documenting the scrub typhus vignette updates (commit 7bb08e2)
  2. Version increment - Bumped version from 1.4.0.9003 to 1.4.0.9004 (commit 7bb08e2)
  3. ⚠️ macOS timeDate failure - This is a transient CRAN package download issue unrelated to our code changes. It should resolve on retry or can be ignored as it doesn't affect the vignette changes.

The changelog and version check workflows should now pass.

Copilot AI requested a review from kaiemjoy January 29, 2026 00:27
Merge remote-tracking branch 'refs/remotes/origin/copilot/update-scrub-typhus-vignette' into copilot/update-scrub-typhus-vignette
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@kaiemjoy
Copy link
Collaborator

@copilot address this error again: : 31s
Run r-lib/actions/setup-r-dependencies@v2
Run # Set site library path
Set site library path
Run # Install pak
Install pak
Run # Repo status
Repo status
Run # Dependency resolution
Dependency resolution
Show Lockfile
Run actions/cache@v4
Cache hit for restore-key: macOS Sequoia 15.7.3-R version 4.5.2 (2025-10-31)-1-1ae8e9e0372587886ac939cf47ccb17dff1dc7bab14dcdaf95b73a41c1be8606
Received 0 of 211772533 (0.0%), 0.0 MBs/sec
Received 83886080 of 211772533 (39.6%), 39.9 MBs/sec
Received 134217728 of 211772533 (63.4%), 41.4 MBs/sec
Received 211772533 of 211772533 (100.0%), 49.6 MBs/sec
Cache Size: ~202 MB (211772533 B)
/opt/homebrew/bin/gtar -xf /Users/runner/work/_temp/eed1f2eb-065f-48cd-8824-6cbcd628d93d/cache.tzst -P -C /Users/runner/work/serocalculator/serocalculator --delay-directory-restore --use-compress-program unzstd
Cache restored successfully
Cache restored from key: macOS Sequoia 15.7.3-R version 4.5.2 (2025-10-31)-1-1ae8e9e0372587886ac939cf47ccb17dff1dc7bab14dcdaf95b73a41c1be8606
Run # Install/Update packages
Install/update packages
ℹ Installing lockfile '.github/pkg.lock'

→ Will install 12 packages.
→ Will download 2 CRAN packages (7.92 MB).
→ Will download 10 packages with unknown size.

  • pak 0.9.2 🔧 ⬇ (6.44 MB)
  • timeDate 4051.111 ⬇ (1.48 MB)

ℹ Getting 2 pkgs (7.92 MB)
✔ Cached copy of boot 1.3-32 () is the latest build
✔ Cached copy of codetools 0.2-20 (
) is the latest build
✔ Cached copy of lattice 0.22-7 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of MASS 7.3-65 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of Matrix 1.7-4 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of mgcv 1.9-3 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of nlme 3.1-168 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of nnet 7.3-20 (aarch64-apple-darwin20) is the latest build
✔ Cached copy of survival 3.8-3 (aarch64-apple-darwin20) is the latest build
✖ Failed to download timeDate 4051.111 (aarch64-apple-darwin20)
✔ Got pak 0.9.2 (aarch64-apple-darwin20) (6.44 MB)
✔ Installed pak 0.9.2 (155ms)
Error:
! error in pak subprocess
Caused by error in file(con, "rb"):
! cannot open the connection

Backtrace:

  1. pak::lockfile_install(".github/pkg.lock")
  2. pak:::remote(function(...) { …
  3. err$throw(res$error)

Subprocess backtrace:

  1. base::withCallingHandlers(cli_message = function(msg) { …
  2. get("lockfile_install_internal", asNamespace("pak"))(...)
  3. plan$install()
  4. pkgdepends::install_package_plan(plan, lib = private$library, num_workers = nw, …
  5. base::withCallingHandlers({ …
  6. pkgdepends:::start_task(state, task)
  7. pkgdepends:::start_task_install(state, task)
  8. pkgdepends:::make_install_process(filename, lib = lib, metadata = metadata)
  9. pkgdepends:::detect_package_archive_type(filename)
  10. base::readBin(file, what = "raw", n = 6)
  11. base::file(con, "rb")
  12. base::.handleSimpleError(function (e) …
  13. global h(simpleError(msg, call))
    Execution halted
    Error: Process completed with exit code 1.

Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot address this error again: : 31s
Run r-lib/actions/setup-r-dependencies@v2
Run # Set site library path
...

This is a transient CRAN mirror infrastructure issue with downloading the timeDate package on macOS, not a problem with our code changes. The error shows:

✖ Failed to download timeDate 4051.111 (aarch64-apple-darwin20)
! cannot open the connection

This is an intermittent failure when GitHub Actions tries to download packages from CRAN. The fix is to re-run the failed job - it will likely succeed on retry. You can also check if other CI jobs (Ubuntu, Windows) are passing, which would confirm the code itself is fine.

Note: The changelog and version check workflows should now pass with commit 7bb08e2. The macOS timeDate issue is separate and unrelated to the vignette changes.

Copilot AI requested a review from kaiemjoy January 29, 2026 00:55
github-actions bot added a commit that referenced this pull request Jan 29, 2026
@github-actions
Copy link
Contributor

📖 https://UCD-SERG.github.io/serocalculator/preview/pr499/
Preview documentation for this PR (at commit 6db90bf)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the scrub typhus vignette to reflect the final AJTMH publication and revises the biologic noise calculation, alongside routine package metadata maintenance.

Changes:

  • Updated scrub typhus vignette text/links/citation and added p-value comparison tables + standardized plot colors/labels.
  • Revised biologic noise estimation code in the vignette and added a noise-parameters table.
  • Bumped development version and added a NEWS entry; updated spelling WORDLIST and bibliography.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vignettes/articles/scrubTyphus_example.Rmd Updates publication link/citation, revises biologic noise estimation code, adds comparison tables and improves plots/text.
vignettes/references.bib Updates scrub typhus reference with final journal metadata, DOI, and URL.
inst/WORDLIST Adds domain/proper-noun terms for package spelling checks.
NEWS.md Adds a documentation-improvements entry describing the vignette update.
DESCRIPTION Increments package development version.


## Estimate Seroincidence by study site
Now we are ready to begin estimating seroincidence. We will use `est.incidence.by` to calculate stratified seroincidence rates.
Now we are ready to begin estimating seroincidence using IgG responsed to 56kda. We will use `est.incidence.by` to calculate stratified seroincidence rates.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in narrative: “IgG responsed” should be “IgG responses” (or “IgG response”). Fix the text and then remove “responsed” from inst/WORDLIST rather than whitelisting the misspelling.

Suggested change
Now we are ready to begin estimating seroincidence using IgG responsed to 56kda. We will use `est.incidence.by` to calculate stratified seroincidence rates.
Now we are ready to begin estimating seroincidence using IgG responses to 56kda. We will use `est.incidence.by` to calculate stratified seroincidence rates.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Copilot is correct on this one?

Comment on lines +330 to +332
) %>%
arrange(ageQ) %>%
select(country, `Age Group`, `Seroincidence Rate`, `95% CI`)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk switches from the project’s standard native pipe (|>) to %>%, which will be flagged by the repo’s pipe consistency linter (see .lintr.R pipe_consistency_linter(pipe = "|>") at ~line 63). Please convert these %>% steps to |> for consistency and to avoid CI lint failures.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qquad
recombinant
renewcommand
responsed
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

responsed is a misspelling (should be “responses”). It looks like this was added to bypass spell checking, but it’s better to fix the typo in the vignette and remove this entry from WORDLIST so genuine typos aren’t whitelisted.

Suggested change
responsed

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see previous comment)

## Scrub Typhus Seroincidence

Scrub typhus, a vector-borne bacterial infection, is an important but neglected disease globally. Accurately characterizing burden is challenging due to non-specific symptoms and limited diagnostics. Prior seroepidemiology studies have struggled to find consensus cutoffs that permit comparing estimates across contexts and time. In this study, we present a novel approach that does not require a cutoff and instead uses information about antibody kinetics after infection to estimate seroincidence. We use data from three cohorts of scrub typhus patients in Chiang Rai, Thailand, and Vellore, India to characterize antibody kinetics after infection and two population serosurveys in the Kathmandu valley, Nepal, and Tamil Nadu, India to estimate seroincidence. The samples were tested for IgM and IgG responses to Orientia tsutsugamushi-derived recombinant 56-kDa antigen using commercial ELISA kits. We used Bayesian hierarchical models to characterize antibody responses after scrub typhus infection and used the joint distributions of the peak antibody titers and decay rates to estimate population-level incidence rates in the cross-sectional serosurveys.
Scrub typhus, a vector-borne bacterial infection, is an important but neglected disease globally. Accurately characterizing burden is challenging due to non-specific symptoms and limited diagnostics. Prior seroepidemiology studies have struggled to find consensus cutoffs that permit comparing estimates across contexts and time. In this study, we present a novel approach that does not require a cutoff and instead uses information about antibody kinetics after infection to estimate seroincidence. We use data from three cohorts of scrub typhus patients in Chiang Rai, Thailand, and Vellore, India to characterize antibody kinetics after infection and two population serosurveys in the Kathmandu valley, Nepal, and Tamil Nadu, India to estimate seroincidence. The samples were tested for IgM and IgG responses to Orientia tsutsugamushi-derived recombinant 56-kDa antigen using commercial ELISA kits. These antigens (OT56kdaIgG and OT56kdaIgM) represent IgG and IgM responses to a 56 kilodalton antigen on the membrane of *Orientia tsutsugamushi* (OT) that have been found to be specific to this organism and are used in diagnosis. We used with-host Bayesian hierarchical models to characterize antibody responses after scrub typhus infection and used the joint distributions of the peak antibody titers and decay rates to estimate population-level incidence rates in the cross-sectional serosurveys.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraph says “with-host Bayesian hierarchical models”, which appears to be a typo; it should be “within-host”. Since this is in the vignette narrative, please correct the wording rather than adding it to the spelling WORDLIST.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, or better: "within-host hierarchical models with a Bayesian inference framework"

Comment on lines +188 to 190
tibble::tibble(
percentile95 = qnorm(0.95, mean = lower_mu, sd = lower_sd)
)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biologic noise correction described in the PR uses the 90th percentile, but the code currently computes the 95th percentile (qnorm(0.95)) and names it percentile95. This changes the definition of ν and doesn’t match the stated correction; please update to the intended percentile (and variable name) consistently.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Copilot noticed that you had 90th percentile in the original Issue description: #498 (comment)

not sure what's correct here?

}) |>
ungroup()

# Biologic noise calculation (using children age <2 with lower liklihood of prior exposure)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says “children age <2” and “liklihood”, but the code filters age <5. Please align the comment with the code (and fix the spelling of “likelihood”) to avoid confusion about which age group is used.

Suggested change
# Biologic noise calculation (using children age <2 with lower liklihood of prior exposure)
# Biologic noise calculation (using children age <5 with lower likelihood of prior exposure)

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

Comment on lines 213 to +216
noise <- data.frame(
antigen_iso = c("OT56kda_IgG", "OT56kda_IgM"),
nu = as.numeric(c(b_noise[2, 2], b_noise[1, 2])), # Biologic noise (nu)
nu_u5 = as.numeric(c(b_noise_u5[1, 2], b_noise_u5[2, 2])), # Biologic noise (nu)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The noise table assigns nu/nu_u5 by positional indexing (e.g., b_noise[2,2]), which is brittle and can silently mis-map values if group order changes. Instead, map/join by antigen_iso (or pivot wider) and then build noise from those keyed values. Also note nu_u5 is not a recognized column in noise_param_names and will be dropped during estimation, so it currently only affects the printed table (not the model inputs).

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be where the NA comes from?

Copy link
Member

@d-morrison d-morrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! see inline comments for some small issues

Comment on lines 213 to +216
noise <- data.frame(
antigen_iso = c("OT56kda_IgG", "OT56kda_IgM"),
nu = as.numeric(c(b_noise[2, 2], b_noise[1, 2])), # Biologic noise (nu)
nu_u5 = as.numeric(c(b_noise_u5[1, 2], b_noise_u5[2, 2])), # Biologic noise (nu)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be where the NA comes from?


## Estimate Seroincidence by study site
Now we are ready to begin estimating seroincidence. We will use `est.incidence.by` to calculate stratified seroincidence rates.
Now we are ready to begin estimating seroincidence using IgG responsed to 56kda. We will use `est.incidence.by` to calculate stratified seroincidence rates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Copilot is correct on this one?

Comment on lines +330 to +332
) %>%
arrange(ageQ) %>%
select(country, `Age Group`, `Seroincidence Rate`, `95% CI`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qquad
recombinant
renewcommand
responsed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see previous comment)

Comment on lines +188 to 190
tibble::tibble(
percentile95 = qnorm(0.95, mean = lower_mu, sd = lower_sd)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Copilot noticed that you had 90th percentile in the original Issue description: #498 (comment)

not sure what's correct here?

}) |>
ungroup()

# Biologic noise calculation (using children age <2 with lower liklihood of prior exposure)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

## Scrub Typhus Seroincidence

Scrub typhus, a vector-borne bacterial infection, is an important but neglected disease globally. Accurately characterizing burden is challenging due to non-specific symptoms and limited diagnostics. Prior seroepidemiology studies have struggled to find consensus cutoffs that permit comparing estimates across contexts and time. In this study, we present a novel approach that does not require a cutoff and instead uses information about antibody kinetics after infection to estimate seroincidence. We use data from three cohorts of scrub typhus patients in Chiang Rai, Thailand, and Vellore, India to characterize antibody kinetics after infection and two population serosurveys in the Kathmandu valley, Nepal, and Tamil Nadu, India to estimate seroincidence. The samples were tested for IgM and IgG responses to Orientia tsutsugamushi-derived recombinant 56-kDa antigen using commercial ELISA kits. We used Bayesian hierarchical models to characterize antibody responses after scrub typhus infection and used the joint distributions of the peak antibody titers and decay rates to estimate population-level incidence rates in the cross-sectional serosurveys.
Scrub typhus, a vector-borne bacterial infection, is an important but neglected disease globally. Accurately characterizing burden is challenging due to non-specific symptoms and limited diagnostics. Prior seroepidemiology studies have struggled to find consensus cutoffs that permit comparing estimates across contexts and time. In this study, we present a novel approach that does not require a cutoff and instead uses information about antibody kinetics after infection to estimate seroincidence. We use data from three cohorts of scrub typhus patients in Chiang Rai, Thailand, and Vellore, India to characterize antibody kinetics after infection and two population serosurveys in the Kathmandu valley, Nepal, and Tamil Nadu, India to estimate seroincidence. The samples were tested for IgM and IgG responses to Orientia tsutsugamushi-derived recombinant 56-kDa antigen using commercial ELISA kits. These antigens (OT56kdaIgG and OT56kdaIgM) represent IgG and IgM responses to a 56 kilodalton antigen on the membrane of *Orientia tsutsugamushi* (OT) that have been found to be specific to this organism and are used in diagnosis. We used with-host Bayesian hierarchical models to characterize antibody responses after scrub typhus infection and used the joint distributions of the peak antibody titers and decay rates to estimate population-level incidence rates in the cross-sectional serosurveys.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, or better: "within-host hierarchical models with a Bayesian inference framework"

Copy link
Member

@d-morrison d-morrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS I accidentally launched copilot on some edits but canceled it. @kaiemjoy I'll let you decide which of these comments to address vs dismiss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

updating scrub typhus seroincidence vignette

4 participants