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.3633442 -0.2215560 0.9160445 0.2902095
#> 2 0.7721447 0.1459751 1.3463734 0.3062297
#> 3 1.1476296 0.5005040 1.7445525 0.3173651
#> 4 -0.0978154 -0.6475848 0.4608360 0.2827656
#> 5 1.1071717 0.4268373 1.7371203 0.3342620
#> 6 1.4525291 0.9184392 1.9378269 0.2600527
#> 7 -0.1621166 -0.7149772 0.4053362 0.2857995
#> 8 0.3809725 -0.2428391 0.9731956 0.3102186
#> 9 1.1543678 0.5655266 1.6930417 0.2876367
#> 10 0.1361149 -0.4309147 0.6909088 0.2861847
#> 11 0.6254329 -0.0715306 1.2756716 0.3436803
#> 12 1.3846512 0.7810774 1.9391390 0.2954293
#> 13 0.1129226 -0.4440026 0.6595497 0.2815236
#> 14 0.3980328 -0.2251682 0.9882119 0.3095414
#> 15 1.4982276 0.8546360 2.0932464 0.3159778