Perform Bayesian posterior inference regarding an outcome of interest with bias correction using negative control analysis. There is an option to not perform bias correction so that un-corrected results can be obtained.

```
biasCorrectionInference(
likelihoodProfiles,
ncLikelihoodProfiles = NULL,
biasDistributions = NULL,
priorMean = 0,
priorSd = 1,
numsamps = 10000,
thin = 10,
doCorrection = TRUE,
seed = 1,
...
)
```

- likelihoodProfiles
A list of grid profile likelihoods for the outcome of interest.

- ncLikelihoodProfiles
Likelihood profiles for the negative control outcomes. Must be a list of lists of profile likelihoods; if there is only one analysis period, then this must be a length-1 list, with the first item as a list all outcome-wise profile likelihoods.

- biasDistributions
Pre-saved bias distribution(s), formatted as the output from

`fitBiasDistribution()`

or`sequentialFitBiasDistribution()`

. If NULL, then`ncLikelihoodProfiles`

must be provided.- priorMean
Prior mean for the effect size (log rate ratio).

- priorSd
Prior standard deviation for the effect size (log rate ratio).

- numsamps
Total number of MCMC samples needed.

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

- doCorrection
Whether or not to perform bias correction; default: TRUE.

- seed
Seed for the random number generator.

- ...
Arguments to be passed to

`sequentialFitBiasDistribution()`

to fit bias distributions if`biasDistributions`

is NULL.

A dataframe with five columns, including posterior `median`

and `mean`

of log RR
effect size estimates, 95% credible intervals (`ci95Lb`

and `ci95Ub`

),
posterior probability that log RR > 0 (`p1`

), and the period or group ID (`Id`

).

It is accompanied by the following attributes:

`samplesCorrected`

: all MCMC samples for the bias corrected log RR effect size estimate.`samplesRaw`

: all MCMC samples for log RR effect size estimate, without bias correction.`biasDistributions`

: the learned empirical bias distribution from negative control analysis.`summaryRaw`

: a summary dataframe (same format as in the main result) without bias correction.`corrected`

: a logical flag indicating if bias correction has been performed; = TRUE if`doCorrection = TRUE`

.

```
# load example data
data("ncLikelihoods")
data("ooiLikelihoods")
# perform sequential analysis with bias correction, using the t model
# NOT RUN
# bbcResults = biasCorrectionInference(ooiLikelihoods,
# ncLikelihoodProfiles = ncLikelihoods,
# robust = TRUE,
# seed = 42)
# check out analysis summary
# bbcResults
```