#> # A tibble: 1 × 11
#> est.start incidence.rate SE CI.lwr CI.upr se_type coverage log.lik
#> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 0.1 0.166 0.0178 0.135 0.205 standard 0.95 -524.
#> # ℹ 3 more variables: iterations <int>, antigen.isos <chr>,
#> # nlm.convergence.code <ord>
Version Crosswalk: v1.3.0 to v1.4.0
Invalid Date
1 Overview
This guide helps users migrate code from serocalculator v1.3.0 to v1.4.0. The main changes are function renamings for improved clarity and consistency.
If you have existing code using v1.3.0, use this guide to update your function calls.
2 Quick Reference Table
2.1 Main Estimation Functions
| v1.3.0 Function | v1.4.0 Function | What it does |
|---|---|---|
est.incidence() |
est_seroincidence() |
Estimate seroincidence for entire dataset |
est.incidence.by() |
est_seroincidence_by() |
Estimate seroincidence stratified by groups |
The intermediate names estimate_scr() and estimate_scr_by() were used briefly in early v1.4.0 development but replaced with the final names shown above.
2.2 Data Preparation Functions
| v1.3.0 Function | v1.4.0 Function | What it does |
|---|---|---|
load_curve_params() |
load_sr_params() |
Load seroresponse curve parameters |
as_curve_params() |
as_sr_params() |
Convert data to seroresponse parameters |
sim.cs() |
sim_pop_data() |
Simulate cross-sectional population data |
sim.cs.multi() |
sim_pop_data_multi() |
Simulate multiple cross-sectional datasets |
2.3 Function Arguments
| v1.3.0 Argument | v1.4.0 Argument | Used in functions |
|---|---|---|
curve_params |
sr_params |
est_seroincidence(), est_seroincidence_by()
|
3 Code Examples
3.1 Example 1: Basic Seroincidence Estimation
Old code (v1.3.0):
# Load curve parameters (v1.3.0 - DEPRECATED)
curve_params <- load_curve_params("parameters.rds")
# Estimate seroincidence
results <- est.incidence(
pop_data = my_data,
curve_params = curve_params
)New code (v1.4.0):
3.2 Example 2: Stratified Analysis
Old code (v1.3.0):
# Stratified estimation (v1.3.0 - DEPRECATED)
results_by_group <- est.incidence.by(
pop_data = my_data,
curve_params = curve_params,
strata = c("age_group", "location")
)New code (v1.4.0):
#> Warning: `curve_params` is missing all strata variables and will be used unstratified.
#> ℹ To avoid this warning, specify the desired set of stratifying variables in
#> the `curve_strata_varnames` and `noise_strata_varnames` arguments to
#> `est_seroincidence_by()`.
#> Warning: `noise_params` is missing all strata variables and will be used unstratified.
#> ℹ To avoid this warning, specify the desired set of stratifying variables in
#> the `curve_strata_varnames` and `noise_strata_varnames` arguments to
#> `est_seroincidence_by()`.
#> Seroincidence estimated given the following setup:
#> a) Antigen isotypes : HlyE_IgA, HlyE_IgG
#> b) Strata : Country
#>
#> Seroincidence estimates:
#> # A tibble: 1 × 14
#> Stratum Country n est.start incidence.rate SE CI.lwr CI.upr se_type
#> <chr> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 Stratum 1 Pakistan 100 0.1 0.166 0.0178 0.135 0.205 standa…
#> # ℹ 5 more variables: coverage <dbl>, log.lik <dbl>, iterations <int>,
#> # antigen.isos <chr>, nlm.convergence.code <ord>
3.3 Example 3: Simulating Data
Old code (v1.3.0):
# Simulate cross-sectional data (v1.3.0 - DEPRECATED)
simulated_data <- sim.cs(
curve_params = curve_params,
n = 100
)
# Simulate multiple datasets
multiple_sims <- sim.cs.multi(
curve_params = curve_params,
n = 100,
n_reps = 10
)New code (v1.4.0):
#> Warning: Some dimension variables are not factors.
#> ℹ These dimensions will be ordered by first appearance.
#> ℹ Check results using `dimnames()`.
#> # A tibble: 6 × 4
#> age id antigen_iso value
#> <dbl> <chr> <chr> <dbl>
#> 1 0.44 1 HlyE_IgA 0.863
#> 2 0.44 1 HlyE_IgG 0.242
#> 3 5.84 2 HlyE_IgA 8.25
#> 4 5.84 2 HlyE_IgG 24.7
#> 5 7.84 3 HlyE_IgA 1.56
#> 6 7.84 3 HlyE_IgG 3.00
#> Warning: Some dimension variables are not factors.
#> ℹ These dimensions will be ordered by first appearance.
#> ℹ Check results using `dimnames()`.
#> Some dimension variables are not factors.
#> ℹ These dimensions will be ordered by first appearance.
#> ℹ Check results using `dimnames()`.
#> Some dimension variables are not factors.
#> ℹ These dimensions will be ordered by first appearance.
#> ℹ Check results using `dimnames()`.
#> [1] 600
4 New Features in v1.4.0
In addition to the renamed functions, v1.4.0 includes several new features:
-
compare_seroincidence(): New function for statistical comparison of seroincidence rates between groups -
Enhanced plotting: Additional options for
autoplot.curve_params()includinglog_x,log_y, andchain_color -
Extended simulation analysis: New
analyze_sims()andautoplot.sim_results()functions - Improved documentation: Multi-version pkgdown documentation with version dropdown
5 Other Notable Changes
- Main estimation functions (
est_seroincidence(),est_seroincidence_by()) now usesr_paramsargument instead ofcurve_params - Function names now use snake_case instead of dots (e.g.,
est.incidence()→est_seroincidence()) - Many internal improvements to error messages and warnings
Important: Not all functions changed their parameter names. Functions like sim_pop_data() and graph_loglik() still use curve_params as the parameter name. Only the main estimation functions use sr_params.
6 Need More Help?
- See the NEWS file for complete details
- Check the main tutorial for comprehensive examples using v1.4.0 syntax
- Visit the function reference for detailed documentation
7 Summary
The transition from v1.3.0 to v1.4.0 primarily involves:
- Replace dots in function names with underscores (e.g.,
est.incidence()→est_seroincidence()) - Update
curve_paramsarguments tosr_paramsfor estimation functions only - Use the new
load_sr_params()andas_sr_params()instead of the_curve_paramsversions - Use
.rdsfiles withload_sr_params()(not.csvfiles)
Quick search-and-replace tips:
-
est.incidence.by(→est_seroincidence_by( -
est.incidence(→est_seroincidence( -
load_curve_params(→load_sr_params( -
as_curve_params(→as_sr_params( -
sim.cs.multi(→sim_pop_data_multi( -
sim.cs(→sim_pop_data(
Within calls to est_seroincidence() and est_seroincidence_by():
-
curve_params =→sr_params =
Do not change curve_params to sr_params in other functions like sim_pop_data().