Learn an empirical distribution on estimation bias by simultaneously analyzing a large set of negative control outcomes by a Bayesian hierarchical model through MCMC. Analysis is based on a list of extracted likelihood profiles.

fitBiasDistribution(
  likelihoodProfiles,
  priorSds = c(2, 0.5),
  numsamps = 10000,
  thin = 10,
  minNCs = 5,
  robust = FALSE,
  df = 4,
  seed = 1
)

Arguments

likelihoodProfiles

A list of grid profile likelihoods regarding negative controls.

priorSds

A two-dimensional vector with the standard deviation of the prior for the average bias and the sd/scale parameter, respectively.

numsamps

Total number of MCMC samples needed.

thin

Thinning frequency: how many iterations before another sample is obtained?

minNCs

Minimum number of negative controls needed to fit a bias distribution; default (also recommended): 5.

robust

Whether or not to use a t-distribution model; default: FALSE.

df

Degrees of freedom for the t-model, only used if robust is TRUE.

seed

Seed for the random number generator.

Value

A dataframe with three columns and numsamps number of rows. Column mean includes MCMC samples for the average bias, scale for the sd/scale parameter, and bias for predictive samples of the bias.

Examples

# load example data
data("ncLikelihoods")

# fit a bias distributions by analyzing a set of negative control outcomes
# for example, for the 5th analysis period, and using the t model
# NOT RUN
# biasDistribution = fitBiasDistribution(ncLikelihoods[[5]], robust = TRUE)