diff --git a/articles/biokinetics.html b/articles/biokinetics.html index 67bdfce..5b63283 100644 --- a/articles/biokinetics.html +++ b/articles/biokinetics.html @@ -121,14 +121,14 @@
res <- mod$simulate_population_trajectories()
head(res)
-#> t me lo hi titre_type infection_history
-#> <int> <num> <num> <num> <char> <char>
-#> 1: 0 76.47141 57.27662 102.3284 Ancestral Infection naive
-#> 2: 1 95.17182 72.93386 123.2567 Ancestral Infection naive
-#> 3: 2 117.85935 92.96590 147.9895 Ancestral Infection naive
-#> 4: 3 145.82635 115.93716 178.9671 Ancestral Infection naive
-#> 5: 4 180.04790 145.31797 220.9776 Ancestral Infection naive
-#> 6: 5 222.61054 179.30822 277.7049 Ancestral Infection naive
+#> time_since_last_exp me lo hi titre_type infection_history
+#> <int> <num> <num> <num> <char> <char>
+#> 1: 0 122.4521 94.33718 159.6148 Alpha Infection naive
+#> 2: 1 153.0463 120.28414 192.0631 Alpha Infection naive
+#> 3: 2 190.3371 154.97114 235.0330 Alpha Infection naive
+#> 4: 3 236.9884 195.79415 286.8267 Alpha Infection naive
+#> 5: 4 294.8035 246.31186 355.2880 Alpha Infection naive
+#> 6: 5 367.0770 307.58535 442.0933 Alpha Infection naive
See data for the definition of the returned columns.
Using ggplot2
:
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
@@ -257,14 +257,14 @@
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 @@ -277,8 +277,8 @@
Plotting the median values:
-plot_data <- combined_data[calendar_date == date_delta]
+plot_data <- combined_data[calendar_day == date_delta]
plot_data <- plot_data[, titre_type := forcats::fct_relevel(
titre_type,
c("Ancestral", "Alpha", "Delta"))]
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 aa669a5..5324e32 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-8-1.png b/articles/biokinetics_files/figure-html/unnamed-chunk-8-1.png
index 1627ab3..f973b80 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 ae3faf2..762345e 100644
--- a/articles/data.html
+++ b/articles/data.html
@@ -86,37 +86,65 @@ A guide to model input and output data
Input data
-The model requires a data table containing the following columns:
-
-
-
-
-
-
-censored
-
-Whether this observation should be censored: -1 for lower, 1 for
-upper, 0 for none
+The model requires time series data about individual titre readings,
+along with last exposure times. Times can be relative (e.g. day of
+study) or absolute (i.e. precise calendar dates). The full list of
+required columns is as follows:
+
+
+
+
+
+
+
+
+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
+
+
+
It can also contain further columns for any covariates to be included
in the model. The data files installed with this package have additional
columns infection_history, last_vax_type, and exp_num.
@@ -125,6 +153,28 @@ censoredcategorical variables; that is, converted to factors
regardless of their input type.
+
+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
+#> last_vax_type exp_num
+#> <char> <int>
+#> 1: BNT162b2 2
+#> 2: BNT162b2 2
+#> 3: BNT162b2 2
+#> 4: BNT162b2 2
+#> 5: BNT162b2 2
+#> 6: BNT162b2 2
@@ -154,26 +204,274 @@ simulate_population_trajectoriessummarise argument is TRUE
or
FALSE
.
-
--
-
summarise = TRUE
Returned columns are:
-
-- t:
-- p:
-- k:
-- me:
-- lo
-- hi
-- titre_type
-
-There will also be a column for each covariate in the hierarchical
+
+summarise = TRUE
+
+Returned columns are
+
+
+
+
+
+
+
+name
+type
+description
+
+
+
+time_since_last_exp
+integer
+Number of days since last exposure
+
+
+me
+numeric
+Median titre value
+
+
+lo
+numeric
+Titre value at the 0.025 quantile
+
+
+hi
+numeric
+Titre value at the 0.975 quantile
+
+
+titre_type
+character
+Name of the titre or biomarker
+
+
+censored
+-1, 0 or 1
+Whether this observation should be treated as censored: -1 for
+lower, 1 for upper, 0 for none
+
+
+
+There will also be a column for each covariate in the regression
model.
-
-summarise = FALSE
Returned columns are t, p, k,
-t0_pop, tp_pop, ts_pop, m1_pop, m2_pop, m3_pop, beta_t0, beta_tp,
-beta_ts, beta_m1, beta_m2, beta_m3, mu .draw, titre_type and a column
-for each covariate in the hierarchical model.
-
+
+
+summarise = FALSE
+
+Returned columns are
+
+
+name
+type
+description
+
+
+
+time_since_last_exp
+integer
+Number of days since last exposure
+
+
+t0_pop
+numeric
+
+
+
+tp_pop
+numeric
+
+
+
+ts_pop
+numeric
+
+
+
+m1_pop
+numeric
+
+
+
+m2_pop
+numeric
+
+
+
+m3_pop
+numeric
+
+
+
+beta_t0
+numeric
+
+
+
+beta_tp
+numeric
+
+
+
+beta_ts
+numeric
+
+
+
+beta_m1
+numeric
+
+
+
+beta_m2
+numeric
+
+
+
+beta_t3
+numeric
+
+
+
+mu
+numeric
+Titre value
+
+
+.draw
+integer
+Draw number
+
+
+titre_type
+numeric
+Name of the titre or biomarker
+
+
+
+There will also be column for each covariate in the hierarchical
+model.
+
+
+
+simulate_individual_trajectories
+
+See the documentation for this function here.
+There are 2 different output formats depending on whether the provided
+summarise
argument is TRUE
or
+FALSE
.
+
+summarise = FALSE
+
+Returned columns are
+
+
+
+
+
+
+
+name
+type
+description
+
+
+
+pid
+character or numeric
+Unique person identifier as provided in input data
+
+
+draw
+integer
+Which draw from the fits this is
+
+
+time_since_last_exp
+integer
+Number of days since last exposure
+
+
+mu
+numeric
+Titre value
+
+
+titre_type
+character
+Name of the titre or biomarker
+
+
+exposure_day
+integer
+Day of this person’s last exposure
+
+
+calendar_day
+integer
+Day of this titre value
+
+
+time_shift
+integer
+The number of days these exposures have been adjusted by, as
+provided in function arguments
+
+
+
+There will also be a column for each covariate in the regression
+model.
+
+
+summarise = TRUE
+
+Returned columns are
+
+
+
+
+
+
+
+name
+type
+description
+
+
+
+me
+numeric
+Median titre value
+
+
+lo
+numeric
+Titre value at the 0.025 quantile
+
+
+hi
+numeric
+Titre value at the 0.075 quantile
+
+
+titre_type
+character
+Name of the titre or biomarker
+
+
+calendar_day
+integer
+Day of this titre value
+
+
+time_shift
+integer
+The number of days the exposures were adjusted by, as provided in
+function arguments
+
+
+
+
Alex Hill. Contributor, maintainer. +
Alex Hill. Author, maintainer.
Russell T (2024). -epikinetics: Antibody and Cycle Threshold Kinetics Modelling. +
Russell T, Hill A (2024). +epikinetics: Biomarker Kinetics Modelling. R package version 0.0.0.9000.
@Manual{, - title = {epikinetics: Antibody and Cycle Threshold Kinetics Modelling}, - author = {Timothy Russell}, + title = {epikinetics: Biomarker Kinetics Modelling}, + author = {Timothy Russell and Alex Hill}, year = {2024}, note = {R package version 0.0.0.9000}, }diff --git a/index.html b/index.html index 9ed6a70..bc1ea8d 100644 --- a/index.html +++ b/index.html @@ -5,14 +5,14 @@ -
add_exposure_data.Rd
The biokinetics class requires a single data table with titre readings +and last exposure times for all individuals. If you have exposure times and titre readings for the same +set of individuals in separate files, this function will combine them into a single data.table.
+add_exposure_data(dat_sero, dat_inf, exposure_column = "day")
data.table containing titre values in the format required by biokinetics. See data vignette: vignette("data", package = "epikinetics")
.
data.table containing exposure days and person ids corresponding to those in dat_sero. By default the exposure days are expected in a column called 'day'.
Default 'day'. The name of the column containing exposure days. These can be integers or dates.
A data.table with all columns required by the biokinetics model.
+simulate_populati
Process the model results into a data table of titre values over time.
Usage
biokinetics$simulate_population_trajectories(
- time_type = "relative",
t_max = 150,
summarise = TRUE,
n_draws = 2500
@@ -231,11 +225,7 @@ Usage
Arguments
-time_type
-One of 'relative' or 'absolute'. Default 'relative'.
-
-
-t_max
+t_max
Integer. Maximum number of time points to include.
@@ -253,9 +243,9 @@ Arguments
Returns
-A data.table containing titre values at time points. If summarise = TRUE, columns are t, me, lo, hi,
-titre_type, and a column for each covariate in the hierarchical model. If summarise = FALSE, columns are t, .draw
-t0_pop, tp_pop, ts_pop, m1_pop, m2_pop, m3_pop, beta_t0, beta_tp, beta_ts, beta_m1, beta_m2, beta_m3, mu
+
A data.table containing titre values at time points. If summarise = TRUE, columns are time_since_last_exp,
+me, lo, hi, titre_type, and a column for each covariate in the hierarchical model. If summarise = FALSE, columns are
+time_since_last_exp, .draw, t0_pop, tp_pop, ts_pop, m1_pop, m2_pop, m3_pop, beta_t0, beta_tp, beta_ts, beta_m1, beta_m2, beta_m3, mu
titre_type and a column for each covariate in the hierarchical model. See the data vignette for details:
vignette("data", package = "epikinetics")
@@ -307,7 +297,7 @@ ArgumentsArguments
Returns
A data.table. If summarise = TRUE columns are calendar_date, titre_type, me, lo, hi, time_shift.
-If summarise = FALSE, columns are pid, draw, t, mu, titre_type, exposure_date, calendar_date, time_shift
-and a column for each covariate in the hierarchical model. See the data vignette for details:
+If summarise = FALSE, columns are pid, draw, time_since_last_exp, mu, titre_type, exposure_day, calendar_day, time_shift
+and a column for each covariate in the regression model. See the data vignette for details:
vignette("data", package = "epikinetics")
.
diff --git a/reference/epikinetics-package.html b/reference/epikinetics-package.html
index 3b5a848..c5b7a3b 100644
--- a/reference/epikinetics-package.html
+++ b/reference/epikinetics-package.html
@@ -1,5 +1,5 @@
-epikinetics: Antibody and Cycle Threshold Kinetics Modelling — epikinetics-package • epikinetics epikinetics: Biomarker Kinetics Modelling — epikinetics-package • epikinetics
@@ -50,19 +50,19 @@
- epikinetics: Antibody and Cycle Threshold Kinetics Modelling
+ epikinetics: Biomarker Kinetics Modelling
epikinetics-package.Rd
- What the package does (one paragraph).
+ Fit kinetic curves to biomarker data, using a Bayesian hierarchical model
diff --git a/reference/index.html b/reference/index.html
index becdf94..d0ed389 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -58,6 +58,10 @@ All functions
+
+
+ Combine titre data and infection data into biokinetics input format.
+
Biomarker Kinetics Model
diff --git a/sitemap.xml b/sitemap.xml
index 5b5dd96..ff39ca8 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -7,6 +7,7 @@
/articles/model.html
/authors.html
/index.html
+/reference/add_exposure_data.html
/reference/biokinetics.html
/reference/biokinetics_priors.html
/reference/convert_log_scale_inverse.html