diff --git a/articles/biokinetics.html b/articles/biokinetics.html index d9c719a..cc3f4d5 100644 --- a/articles/biokinetics.html +++ b/articles/biokinetics.html @@ -105,7 +105,9 @@

Fitting the model
 dat <- data.table::fread(system.file("delta_full.rds", package = "epikinetics"))
-mod <- epikinetics::biokinetics$new(data = dat, covariate_formula = ~0 + infection_history)
+mod <- epikinetics::biokinetics$new(data = dat,
+                                    lower_censoring_limit = 40,
+                                    covariate_formula = ~0 + infection_history)
 delta <- mod$fit(parallel_chains = 4,
                  iter_warmup = 50,
                  iter_sampling = 200,
@@ -120,26 +122,18 @@ 

Figure 2
 res <- mod$simulate_population_trajectories()
-#> INFO [2024-11-15 12:08:43] Summarising fits
-#> INFO [2024-11-15 12:08:47] Adjusting by regression coefficients
-#> INFO [2024-11-15 12:08:49] Summarising into quantiles
+#> INFO [2024-11-19 13:53:20] Summarising fits
+#> INFO [2024-11-19 13:53:24] Adjusting by regression coefficients
+#> INFO [2024-11-19 13:53:26] Summarising into quantiles
 head(res)
-#>    time_since_last_exp        me        lo       hi titre_type
-#>                  <int>     <num>     <num>    <num>     <char>
-#> 1:                   0  85.03283  61.79873 113.4266  Ancestral
-#> 2:                   1 117.52245  87.99594 151.6198  Ancestral
-#> 3:                   2 161.60170 124.69805 203.8376  Ancestral
-#> 4:                   3 221.98993 173.94588 277.0610  Ancestral
-#> 5:                   4 302.97036 238.14148 381.2043  Ancestral
-#> 6:                   5 417.55537 325.74862 544.8846  Ancestral
-#>    infection_history
-#>               <char>
-#> 1:   Infection naive
-#> 2:   Infection naive
-#> 3:   Infection naive
-#> 4:   Infection naive
-#> 5:   Infection naive
-#> 6:   Infection naive
+#> time_since_last_exp me lo hi titre_type infection_history +#> <int> <num> <num> <num> <char> <char> +#> 1: 0 112.6822 84.4386 143.8971 Ancestral Infection naive +#> 2: 1 142.5849 110.8551 176.8130 Ancestral Infection naive +#> 3: 2 180.8341 145.1370 219.0680 Ancestral Infection naive +#> 4: 3 228.8394 188.6540 274.4430 Ancestral Infection naive +#> 5: 4 290.0701 242.2203 346.9681 Ancestral Infection naive +#> 6: 5 367.5040 308.0682 451.2246 Ancestral Infection naive

See data for the definition of the returned columns.

Using ggplot2:

@@ -188,9 +182,7 @@

Figure 2 scale_colour_manual(values = custom_palette) + scale_fill_manual(values = custom_palette) + guides(colour = "none", fill = "none") + - custom_theme -#> Warning: Removed 6 rows containing missing values or values outside the scale range -#> (`geom_line()`). + custom_theme

@@ -201,20 +193,20 @@

Figure 4
 res <- mod$population_stationary_points(n_draws = 2000)
-#> INFO [2024-11-15 12:08:50] Extracting parameters
-#> INFO [2024-11-15 12:08:51] Adjusting by covariates
-#> INFO [2024-11-15 12:08:51] Calculating peak and switch titre values
-#> INFO [2024-11-15 12:08:51] Recovering covariate names
-#> INFO [2024-11-15 12:08:51] Calculating medians
+#> INFO [2024-11-19 13:53:27] Extracting parameters
+#> INFO [2024-11-19 13:53:27] Adjusting by covariates
+#> INFO [2024-11-19 13:53:27] Calculating peak and switch titre values
+#> INFO [2024-11-19 13:53:28] Recovering covariate names
+#> INFO [2024-11-19 13:53:28] Calculating medians
 head(res)
-#>    infection_history titre_type     mu_p     mu_s rel_drop_me  mu_p_me  mu_s_me
-#>               <char>     <char>    <num>    <num>       <num>    <num>    <num>
-#> 1:   Infection naive  Ancestral 1343.598 246.5053   0.1734832 1315.809 228.7876
-#> 2:   Infection naive  Ancestral 1218.834 253.4858   0.1734832 1315.809 228.7876
-#> 3:   Infection naive  Ancestral 1236.706 242.7546   0.1734832 1315.809 228.7876
-#> 4:   Infection naive  Ancestral 1241.937 218.3664   0.1734832 1315.809 228.7876
-#> 5:   Infection naive  Ancestral 1339.590 205.4437   0.1734832 1315.809 228.7876
-#> 6:   Infection naive  Ancestral 1602.548 232.3682   0.1734832 1315.809 228.7876
+#> infection_history titre_type mu_p mu_s rel_drop_me mu_p_me mu_s_me +#> <char> <char> <num> <num> <num> <num> <num> +#> 1: Infection naive Ancestral 1232.680 256.3040 0.1926824 1231.001 237.135 +#> 2: Infection naive Ancestral 1203.460 222.4226 0.1926824 1231.001 237.135 +#> 3: Infection naive Ancestral 1237.530 223.8834 0.1926824 1231.001 237.135 +#> 4: Infection naive Ancestral 1287.212 231.6793 0.1926824 1231.001 237.135 +#> 5: Infection naive Ancestral 1326.172 257.9224 0.1926824 1231.001 237.135 +#> 6: Infection naive Ancestral 1353.322 270.6602 0.1926824 1231.001 237.135

The values we’re going to plot are the mean peak titre values (mu_p) and mean set point titre values (mu_s), for different titre types and infection histories. See data for a full definition of all the returned @@ -271,24 +263,24 @@

Figure 5
 res <- mod$simulate_individual_trajectories(n_draws = 250)
-#> INFO [2024-11-15 12:08:52] Extracting parameters
-#> INFO [2024-11-15 12:08:56] Simulating individual trajectories
-#> INFO [2024-11-15 12:09:00] Recovering covariate names
-#> INFO [2024-11-15 12:09:00] Calculating exposure days. Adjusting exposures by 0 days
-#> INFO [2024-11-15 12:09:03] Resampling
+#> INFO [2024-11-19 13:53:29] Extracting parameters
+#> INFO [2024-11-19 13:53:32] Simulating individual trajectories
+#> INFO [2024-11-19 13:53:36] Recovering covariate names
+#> INFO [2024-11-19 13:53:37] Calculating exposure days. Adjusting exposures by 0 days
+#> INFO [2024-11-19 13:53:40] Resampling
 #> Registered S3 method overwritten by 'mosaic':
 #>   method                           from   
 #>   fortify.SpatialPolygonsDataFrame ggplot2
-#> INFO [2024-11-15 12:09:14] Summarising into population quantiles
+#> INFO [2024-11-19 13:53:50] Summarising into population quantiles
 head(res)
 #>    calendar_day titre_type       me       lo       hi time_shift
 #>          <IDat>     <char>    <num>    <num>    <num>      <num>
-#> 1:   2021-03-08  Ancestral 1122.561 899.7913 1474.929          0
-#> 2:   2021-03-09  Ancestral 1114.609 882.1468 1450.662          0
-#> 3:   2021-03-10  Ancestral 1150.423 911.1426 1530.973          0
-#> 4:   2021-03-11  Ancestral 1121.402 878.6975 1447.972          0
-#> 5:   2021-03-12  Ancestral 1115.039 851.9412 1443.723          0
-#> 6:   2021-03-13  Ancestral 1150.059 900.9269 1520.740          0
+#> 1: 2021-03-08 Ancestral 1145.101 886.7598 1504.746 0 +#> 2: 2021-03-09 Ancestral 1127.169 881.6767 1452.714 0 +#> 3: 2021-03-10 Ancestral 1159.459 899.3294 1478.496 0 +#> 4: 2021-03-11 Ancestral 1134.535 918.3473 1474.952 0 +#> 5: 2021-03-12 Ancestral 1128.106 884.1373 1525.385 0 +#> 6: 2021-03-13 Ancestral 1164.565 909.3966 1484.574 0

See data for a definition of all the returned columns. Figure 5 A plots the derived population trajectories. Here we replicate a portion of the graph from the paper, from the minimum date @@ -358,72 +350,72 @@

Figure 5 shift <- time_shift_values[index] mod$simulate_individual_trajectories(n_draws = 50, time_shift = shift) }) -#> INFO [2024-11-15 12:09:15] Extracting parameters -#> INFO [2024-11-15 12:09:19] Simulating individual trajectories -#> INFO [2024-11-15 12:09:19] Recovering covariate names -#> INFO [2024-11-15 12:09:19] Calculating exposure days. Adjusting exposures by -75 days -#> INFO [2024-11-15 12:09:20] Resampling -#> INFO [2024-11-15 12:09:22] Summarising into population quantiles -#> INFO [2024-11-15 12:09:22] Extracting parameters -#> INFO [2024-11-15 12:09:26] Simulating individual trajectories -#> INFO [2024-11-15 12:09:26] Recovering covariate names -#> INFO [2024-11-15 12:09:26] Calculating exposure days. Adjusting exposures by -60 days -#> INFO [2024-11-15 12:09:27] Resampling -#> INFO [2024-11-15 12:09:29] Summarising into population quantiles -#> INFO [2024-11-15 12:09:29] Extracting parameters -#> INFO [2024-11-15 12:09:33] Simulating individual trajectories -#> INFO [2024-11-15 12:09:33] Recovering covariate names -#> INFO [2024-11-15 12:09:33] Calculating exposure days. Adjusting exposures by -45 days -#> INFO [2024-11-15 12:09:34] Resampling -#> INFO [2024-11-15 12:09:36] Summarising into population quantiles -#> INFO [2024-11-15 12:09:37] Extracting parameters -#> INFO [2024-11-15 12:09:40] Simulating individual trajectories -#> INFO [2024-11-15 12:09:41] Recovering covariate names -#> INFO [2024-11-15 12:09:41] Calculating exposure days. Adjusting exposures by -30 days -#> INFO [2024-11-15 12:09:41] Resampling -#> INFO [2024-11-15 12:09:43] Summarising into population quantiles -#> INFO [2024-11-15 12:09:44] Extracting parameters -#> INFO [2024-11-15 12:09:47] Simulating individual trajectories -#> INFO [2024-11-15 12:09:48] Recovering covariate names -#> INFO [2024-11-15 12:09:48] Calculating exposure days. Adjusting exposures by -15 days -#> INFO [2024-11-15 12:09:48] Resampling -#> INFO [2024-11-15 12:09:50] Summarising into population quantiles -#> INFO [2024-11-15 12:09:51] Extracting parameters -#> INFO [2024-11-15 12:09:54] Simulating individual trajectories -#> INFO [2024-11-15 12:09:55] Recovering covariate names -#> INFO [2024-11-15 12:09:55] Calculating exposure days. Adjusting exposures by 0 days -#> INFO [2024-11-15 12:09:55] Resampling -#> INFO [2024-11-15 12:09:57] Summarising into population quantiles -#> INFO [2024-11-15 12:09:58] Extracting parameters -#> INFO [2024-11-15 12:10:01] Simulating individual trajectories -#> INFO [2024-11-15 12:10:02] Recovering covariate names -#> INFO [2024-11-15 12:10:02] Calculating exposure days. Adjusting exposures by 15 days -#> INFO [2024-11-15 12:10:02] Resampling -#> INFO [2024-11-15 12:10:04] Summarising into population quantiles -#> INFO [2024-11-15 12:10:05] Extracting parameters -#> INFO [2024-11-15 12:10:08] Simulating individual trajectories -#> INFO [2024-11-15 12:10:09] Recovering covariate names -#> INFO [2024-11-15 12:10:09] Calculating exposure days. Adjusting exposures by 30 days -#> INFO [2024-11-15 12:10:10] Resampling -#> INFO [2024-11-15 12:10:12] Summarising into population quantiles -#> INFO [2024-11-15 12:10:12] Extracting parameters -#> INFO [2024-11-15 12:10:16] Simulating individual trajectories -#> INFO [2024-11-15 12:10:16] Recovering covariate names -#> INFO [2024-11-15 12:10:16] Calculating exposure days. Adjusting exposures by 45 days -#> INFO [2024-11-15 12:10:17] Resampling -#> INFO [2024-11-15 12:10:19] Summarising into population quantiles -#> INFO [2024-11-15 12:10:20] Extracting parameters -#> INFO [2024-11-15 12:10:23] Simulating individual trajectories -#> INFO [2024-11-15 12:10:23] Recovering covariate names -#> INFO [2024-11-15 12:10:23] Calculating exposure days. Adjusting exposures by 60 days -#> INFO [2024-11-15 12:10:24] Resampling -#> INFO [2024-11-15 12:10:26] Summarising into population quantiles -#> INFO [2024-11-15 12:10:26] Extracting parameters -#> INFO [2024-11-15 12:10:30] Simulating individual trajectories -#> INFO [2024-11-15 12:10:31] Recovering covariate names -#> INFO [2024-11-15 12:10:31] Calculating exposure days. Adjusting exposures by 75 days -#> INFO [2024-11-15 12:10:31] Resampling -#> INFO [2024-11-15 12:10:33] Summarising into population quantiles +#> INFO [2024-11-19 13:53:51] Extracting parameters +#> INFO [2024-11-19 13:53:55] Simulating individual trajectories +#> INFO [2024-11-19 13:53:55] Recovering covariate names +#> INFO [2024-11-19 13:53:55] Calculating exposure days. Adjusting exposures by -75 days +#> INFO [2024-11-19 13:53:56] Resampling +#> INFO [2024-11-19 13:53:58] Summarising into population quantiles +#> INFO [2024-11-19 13:53:58] Extracting parameters +#> INFO [2024-11-19 13:54:01] Simulating individual trajectories +#> INFO [2024-11-19 13:54:02] Recovering covariate names +#> INFO [2024-11-19 13:54:02] Calculating exposure days. Adjusting exposures by -60 days +#> INFO [2024-11-19 13:54:03] Resampling +#> INFO [2024-11-19 13:54:04] Summarising into population quantiles +#> INFO [2024-11-19 13:54:05] Extracting parameters +#> INFO [2024-11-19 13:54:08] Simulating individual trajectories +#> INFO [2024-11-19 13:54:09] Recovering covariate names +#> INFO [2024-11-19 13:54:09] Calculating exposure days. Adjusting exposures by -45 days +#> INFO [2024-11-19 13:54:09] Resampling +#> INFO [2024-11-19 13:54:11] Summarising into population quantiles +#> INFO [2024-11-19 13:54:12] Extracting parameters +#> INFO [2024-11-19 13:54:15] Simulating individual trajectories +#> INFO [2024-11-19 13:54:16] Recovering covariate names +#> INFO [2024-11-19 13:54:16] Calculating exposure days. Adjusting exposures by -30 days +#> INFO [2024-11-19 13:54:17] Resampling +#> INFO [2024-11-19 13:54:19] Summarising into population quantiles +#> INFO [2024-11-19 13:54:19] Extracting parameters +#> INFO [2024-11-19 13:54:22] Simulating individual trajectories +#> INFO [2024-11-19 13:54:23] Recovering covariate names +#> INFO [2024-11-19 13:54:23] Calculating exposure days. Adjusting exposures by -15 days +#> INFO [2024-11-19 13:54:23] Resampling +#> INFO [2024-11-19 13:54:25] Summarising into population quantiles +#> INFO [2024-11-19 13:54:26] Extracting parameters +#> INFO [2024-11-19 13:54:29] Simulating individual trajectories +#> INFO [2024-11-19 13:54:30] Recovering covariate names +#> INFO [2024-11-19 13:54:30] Calculating exposure days. Adjusting exposures by 0 days +#> INFO [2024-11-19 13:54:30] Resampling +#> INFO [2024-11-19 13:54:32] Summarising into population quantiles +#> INFO [2024-11-19 13:54:33] Extracting parameters +#> INFO [2024-11-19 13:54:36] Simulating individual trajectories +#> INFO [2024-11-19 13:54:36] Recovering covariate names +#> INFO [2024-11-19 13:54:36] Calculating exposure days. Adjusting exposures by 15 days +#> INFO [2024-11-19 13:54:37] Resampling +#> INFO [2024-11-19 13:54:39] Summarising into population quantiles +#> INFO [2024-11-19 13:54:39] Extracting parameters +#> INFO [2024-11-19 13:54:43] Simulating individual trajectories +#> INFO [2024-11-19 13:54:43] Recovering covariate names +#> INFO [2024-11-19 13:54:43] Calculating exposure days. Adjusting exposures by 30 days +#> INFO [2024-11-19 13:54:44] Resampling +#> INFO [2024-11-19 13:54:46] Summarising into population quantiles +#> INFO [2024-11-19 13:54:46] Extracting parameters +#> INFO [2024-11-19 13:54:49] Simulating individual trajectories +#> INFO [2024-11-19 13:54:50] Recovering covariate names +#> INFO [2024-11-19 13:54:50] Calculating exposure days. Adjusting exposures by 45 days +#> INFO [2024-11-19 13:54:50] Resampling +#> INFO [2024-11-19 13:54:52] Summarising into population quantiles +#> INFO [2024-11-19 13:54:53] Extracting parameters +#> INFO [2024-11-19 13:54:56] Simulating individual trajectories +#> INFO [2024-11-19 13:54:57] Recovering covariate names +#> INFO [2024-11-19 13:54:57] Calculating exposure days. Adjusting exposures by 60 days +#> INFO [2024-11-19 13:54:57] Resampling +#> INFO [2024-11-19 13:54:59] Summarising into population quantiles +#> INFO [2024-11-19 13:55:00] Extracting parameters +#> INFO [2024-11-19 13:55:03] Simulating individual trajectories +#> INFO [2024-11-19 13:55:04] Recovering covariate names +#> INFO [2024-11-19 13:55:04] Calculating exposure days. Adjusting exposures by 75 days +#> INFO [2024-11-19 13:55:04] Resampling +#> INFO [2024-11-19 13:55:06] Summarising into population quantiles combined_data <- data.table::data.table(data.table::rbindlist(results_list))

Plotting the median values:

diff --git a/articles/biokinetics_files/figure-html/unnamed-chunk-10-1.png b/articles/biokinetics_files/figure-html/unnamed-chunk-10-1.png index ffe6d53..dddfd67 100644 Binary files a/articles/biokinetics_files/figure-html/unnamed-chunk-10-1.png and b/articles/biokinetics_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/articles/biokinetics_files/figure-html/unnamed-chunk-4-1.png b/articles/biokinetics_files/figure-html/unnamed-chunk-4-1.png index 4a19ef5..4842f38 100644 Binary files a/articles/biokinetics_files/figure-html/unnamed-chunk-4-1.png and b/articles/biokinetics_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/articles/biokinetics_files/figure-html/unnamed-chunk-6-1.png b/articles/biokinetics_files/figure-html/unnamed-chunk-6-1.png index 6291ace..dee4fd7 100644 Binary files a/articles/biokinetics_files/figure-html/unnamed-chunk-6-1.png and b/articles/biokinetics_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/articles/biokinetics_files/figure-html/unnamed-chunk-8-1.png b/articles/biokinetics_files/figure-html/unnamed-chunk-8-1.png index 8edee61..d9b2f22 100644 Binary files a/articles/biokinetics_files/figure-html/unnamed-chunk-8-1.png and b/articles/biokinetics_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/articles/data.html b/articles/data.html index dc54022..cf9e58e 100644 --- a/articles/data.html +++ b/articles/data.html @@ -95,55 +95,41 @@

Input data - - - + + name type description -required pid numeric or character Unique identifier to identify a person across observations -T day integer or date The day of the observation. Can be a date or an integer representing a relative day of study -T last_exp_day integer or date The most recent day on which the person was exposed. Must be of the same type as the ‘day’ column -T titre_type character Name of the titre or biomarker -T value numeric Titre value -T - - -censored --1, 0 or 1 -Optional column. Whether this observation should be treated as -censored: -1 for lower, 1 for upper, 0 for none. -F @@ -166,14 +152,14 @@

Example
 dat <- data.table::fread(system.file("delta_full.rds", package = "epikinetics"))
 head(dat)
-#>      pid        day last_exp_day titre_type    value censored infection_history
-#>    <int>     <IDat>       <IDat>     <char>    <num>    <int>            <char>
-#> 1:     1 2021-03-10   2021-03-08  Ancestral 175.9350        0   Infection naive
-#> 2:     1 2021-04-15   2021-03-08  Ancestral 607.5750        0   Infection naive
-#> 3:     1 2021-07-08   2021-03-08  Ancestral 179.0463        0   Infection naive
-#> 4:     1 2021-03-10   2021-03-08      Alpha   5.0000       -1   Infection naive
-#> 5:     1 2021-04-15   2021-03-08      Alpha 416.7905        0   Infection naive
-#> 6:     1 2021-07-08   2021-03-08      Alpha 103.5274        0   Infection naive
+#>      pid        day last_exp_day titre_type    value infection_history
+#>    <int>     <IDat>       <IDat>     <char>    <num>            <char>
+#> 1:     1 2021-03-10   2021-03-08  Ancestral 175.9350   Infection naive
+#> 2:     1 2021-04-15   2021-03-08  Ancestral 607.5750   Infection naive
+#> 3:     1 2021-07-08   2021-03-08  Ancestral 179.0463   Infection naive
+#> 4:     1 2021-03-10   2021-03-08      Alpha   5.0000   Infection naive
+#> 5:     1 2021-04-15   2021-03-08      Alpha 416.7905   Infection naive
+#> 6:     1 2021-07-08   2021-03-08      Alpha 103.5274   Infection naive
 #>    last_vax_type exp_num
 #>           <char>   <int>
 #> 1:      BNT162b2       2
@@ -185,7 +171,7 @@ 

Example
-

Ouput data +

Output data

After fitting a model, a CmdStanMCMC object is returned. This means that users who are already familiar with diff --git a/pkgdown.yml b/pkgdown.yml index e2ec282..42078ed 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,4 +5,4 @@ articles: biokinetics: biokinetics.html data: data.html model: model.html -last_built: 2024-11-15T12:04Z +last_built: 2024-11-19T13:48Z diff --git a/reference/biokinetics.html b/reference/biokinetics.html index 456b7c4..ef689b7 100644 --- a/reference/biokinetics.html +++ b/reference/biokinetics.html @@ -89,7 +89,11 @@

Usage

file_path = NULL, covariate_formula = ~0, preds_sd = 0.25, - scale = "natural" + scale = "natural", + upper_censoring_limit = NULL, + lower_censoring_limit = NULL, + strict_upper_limit = TRUE, + strict_lower_limit = TRUE )

@@ -122,6 +126,26 @@

Arguments @@ -158,12 +182,20 @@

Returns

Method plot_model_inputs()

Plot model input data with a smoothing function. Note that -this plot is on a log scale, regardless of whether data was provided on a -log or a natural scale.

+this plot is of the data as provided to the Stan model so is on a log scale, +regardless of whether data was provided on a log or a natural scale.

Usage

-

biokinetics$plot_model_inputs()

+

biokinetics$plot_model_inputs(tmax = 150)

+
+

Arguments

+

tmax
+

Integer. Maximum time since last exposure to include. Default 150.

+ + +

+

Returns

A ggplot2 object.

@@ -201,7 +233,7 @@

Usage

-

Arguments

+

Arguments

...

Named arguments to the sample() method of CmdStan model. objects: https://mc-stan.org/cmdstanr/reference/model-method-sample.html

@@ -225,7 +257,7 @@

Usage

-

Arguments

+

Arguments

n_draws

Integer. Default 2000.

@@ -253,7 +285,7 @@

Usage

-

Arguments

+

Arguments

n_draws

Integer. Default 2000.

@@ -285,7 +317,7 @@

Usage

-

Arguments

+

Arguments

t_max

Integer. Maximum number of time points to include.

@@ -319,7 +351,7 @@

Usage

-

Arguments

+

Arguments

n_draws

Integer. Maximum number of samples to include. Default 2000.

@@ -346,7 +378,7 @@

Usage
-

Arguments

+

Arguments

summarise

Boolean. If TRUE, average the individual trajectories to get lo, me and hi values for the population, disaggregated by titre type. If FALSE return the indidivudal trajectories. diff --git a/reference/convert_log2_scale.html b/reference/convert_log2_scale.html new file mode 100644 index 0000000..c1277df --- /dev/null +++ b/reference/convert_log2_scale.html @@ -0,0 +1,113 @@ + +Base 2 log scale conversion — convert_log2_scale • epikinetics + + +

+
+ + + +
+
+ + +
+

Natural scale data is converted to a base 2 log scale before model fitting. +This function does not modify the provided data.table in-place, but returns a transformed copy.

+
+ +
+
convert_log2_scale(dt_in, smallest_value, vars_to_transform = "value")
+
+ +
+

Arguments

+ + +
dt_in
+

data.table containing data to be transformed to base 2 log scale.

+ + +
smallest_value
+

The lowest value in the original dataset. Used to get the data onto +a scale that starts at zero.

+ + +
vars_to_transform
+

Names of columns to apply the transformation to.

+ +
+
+

Value

+

A data.table, identical to the input data but with specified columns transformed.

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/reference/convert_log2_scale_inverse.html b/reference/convert_log2_scale_inverse.html index d1530d5..a7c870c 100644 --- a/reference/convert_log2_scale_inverse.html +++ b/reference/convert_log2_scale_inverse.html @@ -64,7 +64,7 @@

Invert base 2 log scale conversion

-
convert_log2_scale_inverse(dt_in, vars_to_transform)
+
convert_log2_scale_inverse(dt_in, vars_to_transform, smallest_value)
@@ -78,6 +78,10 @@

Arguments

vars_to_transform

Names of columns to apply the transformation to.

+ +
smallest_value
+

The lowest value in the original dataset.

+

Value

diff --git a/reference/index.html b/reference/index.html index f1fa73b..22d57aa 100644 --- a/reference/index.html +++ b/reference/index.html @@ -69,6 +69,10 @@

All functions biokinetics_priors()

Construct priors for the biomarker model.

+ +

convert_log2_scale()

+ +

Base 2 log scale conversion

convert_log2_scale_inverse()

@@ -81,6 +85,10 @@

All functions plot(<biokinetics_priors>)

Simulate biomarker kinetics predicted by the given biokinetics priors and optionally compare to a dataset.

+ +

plot_sero_data()

+ +

Plot serological data

@@ -89,6 +97,14 @@

Arguments

data

Optional data.frame with columns time_since_last_exp and value. The raw data to compare to.

+ +
upper_censoring_limit
+

Optional upper detection limit.

+ + +
lower_censoring_limit
+

Optional lower detection limit.

+

Value

diff --git a/reference/plot_sero_data.html b/reference/plot_sero_data.html new file mode 100644 index 0000000..fa47ef8 --- /dev/null +++ b/reference/plot_sero_data.html @@ -0,0 +1,126 @@ + +Plot serological data — plot_sero_data • epikinetics + + +
+
+ + + +
+
+ + +
+

Plot serological data in the format provided to the biokinetics +model, with a smoothing function fitted.

+
+ +
+
plot_sero_data(
+  data,
+  tmax = 150,
+  covariates = character(0),
+  upper_censoring_limit = NULL,
+  lower_censoring_limit = NULL
+)
+
+ +
+

Arguments

+ + +
data
+

A data.table with required columns time_since_last_exp, value and titre_type.

+ + +
tmax
+

Integer. The number of time points in each simulated trajectory. Default 150.

+ + +
covariates
+

Optional vector of covariate names to facet by (these must correspond to columns in the data.table)

+ + +
upper_censoring_limit
+

Optional upper detection limit.

+ + +
lower_censoring_limit
+

Optional lower detection limit.

+ +
+
+

Value

+

A ggplot2 object.

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/sitemap.xml b/sitemap.xml index f2c48cf..d269dca 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -10,10 +10,12 @@ /reference/add_exposure_data.html /reference/biokinetics.html /reference/biokinetics_priors.html +/reference/convert_log2_scale.html /reference/convert_log2_scale_inverse.html /reference/epikinetics-package.html /reference/index.html /reference/plot.biokinetics_population_trajectories.html /reference/plot.biokinetics_priors.html +/reference/plot_sero_data.html