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.06324315 -0.59065672 0.4545030 0.2666273
#> 2 0.45521666 -0.11428015 1.0854460 0.3060582
#> 3 1.53239554 0.96948334 2.1806707 0.3089820
#> 4 -0.04231729 -0.55603576 0.4647975 0.2604214
#> 5 0.46723466 -0.01424435 1.0208249 0.2640531
#> 6 1.29945138 0.76651549 1.9152595 0.2930523
#> 7 0.10728856 -0.39809822 0.6293576 0.2621109
#> 8 0.42166084 -0.05490826 0.9643175 0.2600113
#> 9 1.17998553 0.63670559 1.8048702 0.2980067
#> 10 -0.24838566 -0.88816846 0.3594989 0.3182883
#> 11 0.64831443 0.15500716 1.2175696 0.2710668
#> 12 1.12771398 0.58365408 1.7528202 0.2982621
#> 13 -0.37002701 -1.04208520 0.2563093 0.3312292
#> 14 1.33958232 0.68063111 2.0818519 0.3574609
#> 15 0.95228805 0.40475985 1.5790028 0.2995573