Fits a joint Bayesian four-parameter logistic model to two to four biomarkers measured for each person at the same time point. The model estimates one protective slope and EC50 per biomarker and can display a two-biomarker CoP surface.

Public fields

titre

Numeric matrix of log antibody titres.

infected

Binary infection outcomes.

biomarker_names

Names of biomarker columns.

fit

Fitted Stan model object after calling fit_model().

loo

Leave-one-out cross-validation result after fitting.

priors

Prior distribution parameters.

Methods


Method new()

Create a multidimensional CoP model.

Usage

SeroMulti$new(titre, infected, biomarker_names = NULL)

Arguments

titre

Numeric matrix with one row per person and 2–4 biomarker columns.

infected

Binary infection outcome vector.

biomarker_names

Optional names for the biomarker columns.

Returns

A new SeroMulti object.


Method definePrior()

Update prior distributions before fitting.

Usage

SeroMulti$definePrior(
  floor_alpha = NULL,
  floor_beta = NULL,
  ceiling_alpha = NULL,
  ceiling_beta = NULL,
  ec50_mean = NULL,
  ec50_sd = NULL,
  slope_scale = NULL
)

Arguments

floor_alpha, floor_beta

Beta prior parameters for floor.

ceiling_alpha, ceiling_beta

Beta prior parameters for ceiling.

ec50_mean, ec50_sd

Normal prior parameters shared across EC50 values.

slope_scale

Median of the log-normal slope prior.

Returns

Self invisibly.


Method fit_model()

Fit the joint multidimensional Stan model.

Usage

SeroMulti$fit_model(
  chains = 4,
  iter = 2000,
  warmup = floor(iter/2),
  cores = 1,
  ...
)

Arguments

chains

Number of MCMC chains.

iter

Number of iterations per chain.

warmup

Number of warmup iterations per chain.

cores

Number of parallel chains.

...

Additional arguments passed to rstan::sampling.

Returns

Self invisibly.


Method predict()

Predict infection probabilities from posterior draws.

Usage

SeroMulti$predict(newdata = NULL)

Arguments

newdata

Optional numeric matrix with the same biomarker columns.

Returns

Matrix of posterior draws by observations.


Method predict_protection()

Predict correlate-of-protection values from posterior draws.

Usage

SeroMulti$predict_protection(newdata = NULL)

Arguments

newdata

Optional numeric matrix with the same biomarker columns.

Returns

Matrix of posterior draws by observations.


Method surface_data()

Summarise the two-biomarker CoP surface.

Usage

SeroMulti$surface_data(grid_size = 50)

Arguments

grid_size

Number of values along each biomarker axis.

Returns

Data frame containing titres and posterior mean CoP.


Method plot_surface()

Plot the CoP surface for a two-biomarker model.

Usage

SeroMulti$plot_surface(type = c("contour", "persp"), grid_size = 50)

Arguments

type

Either a filled contour plot or a base-R perspective plot.

grid_size

Number of values along each biomarker axis.

Returns

A ggplot object for contour plots; invisibly returns surface data for perspective plots.


Method clone()

The objects of this class are cloneable with this method.

Usage

SeroMulti$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.