R/ConfidenceIntervalCalibration.R
calibrateConfidenceInterval.Rd
Calibrate confidence intervals
calibrateConfidenceInterval(logRr, seLogRr, model, ciWidth = 0.95)
A numeric vector of effect estimates on the log scale.
The standard error of the log of the effect estimates. Hint: often the standard error = (log(<lower bound 95 percent confidence interval>) - log(<effect estimate>))/qnorm(0.025).
An object of type systematicErrorModel
as created by the
fitSystematicErrorModel
function.
The width of the confidence interval. Typically this would be .95, for the 95 percent confidence interval.
A data frame with calibrated confidence intervals and point estimates.
Compute calibrated confidence intervals based on a model of the systematic error.
data <- simulateControls(n = 50 * 3, mean = 0.25, sd = 0.25, trueLogRr = log(c(1, 2, 4)))
model <- fitSystematicErrorModel(data$logRr, data$seLogRr, data$trueLogRr)
newData <- simulateControls(n = 15, mean = 0.25, sd = 0.25, trueLogRr = log(c(1, 2, 4)))
result <- calibrateConfidenceInterval(newData$logRr, newData$seLogRr, model)
result
#> logRr logLb95Rr logUb95Rr seLogRr
#> 1 -0.24092120 -0.77126055 0.2971410 0.2725564
#> 2 0.51143429 -0.03846127 1.0451666 0.2764408
#> 3 1.67003134 1.18807161 2.1352690 0.2416364
#> 4 -0.08602864 -0.67960195 0.5100201 0.3034806
#> 5 0.35030540 -0.26970635 0.9605728 0.3138525
#> 6 1.83872871 1.32165730 2.3392259 0.2595886
#> 7 0.21130896 -0.39207714 0.8086715 0.3063190
#> 8 0.71051654 0.19815566 1.2056072 0.2570077
#> 9 1.31622428 0.73528736 1.8802476 0.2920871
#> 10 0.16157208 -0.45264809 0.7712743 0.3122308
#> 11 0.18650116 -0.42290293 0.7906453 0.3095843
#> 12 2.00135784 1.50775582 2.4784367 0.2476272
#> 13 0.03325048 -0.46659467 0.5319551 0.2547368
#> 14 0.23635225 -0.33009630 0.7956115 0.2871756
#> 15 1.45765382 0.94959499 1.9489044 0.2549306