Title: | Calibration of Confidence Intervals to Support Intervals |
---|---|
Description: | Provides functionality for computing support intervals for univariate parameters based on confidence intervals or parameter estimates with standard errors (Pawel et al., 2023) <doi:10.1080/00031305.2023.2216239>. |
Authors: | Samuel Pawel [aut, cre]
|
Maintainer: | Samuel Pawel <[email protected]> |
License: | GPL-3 |
Version: | 0.42.3 |
Built: | 2025-01-29 04:07:53 UTC |
Source: | https://github.com/samch93/cicalibrate |
This function computes a support interval for an unknown parameter based on either a confidence interval for the parameter or a parameter estimate with standard error.
ciCalibrate( ci = NULL, ciLevel = 0.95, estimate = mean(ci), se = diff(ci) * 0.5/stats::qnorm(p = 0.5 * (1 + ciLevel)), siLevel = 1, method = c("SI-normal", "SI-normal-local", "SI-normal-nonlocal", "mSI-all", "mSI-normal-local", "mSI-eplogp"), priorMean, priorSD )
ciCalibrate( ci = NULL, ciLevel = 0.95, estimate = mean(ci), se = diff(ci) * 0.5/stats::qnorm(p = 0.5 * (1 + ciLevel)), siLevel = 1, method = c("SI-normal", "SI-normal-local", "SI-normal-nonlocal", "mSI-all", "mSI-normal-local", "mSI-eplogp"), priorMean, priorSD )
ci |
Confidence interval given as a numeric vector of length two. |
ciLevel |
Confidence level. Defaults to 0.95. |
estimate |
Parameter estimate. Only required if no confidence interval and confidence level are specified. |
se |
Standard error of the parameter estimate. Only required if no confidence interval and confidence level are specified. |
siLevel |
Support level. Defaults to 1. |
method |
Calibration method. Can either be |
priorMean |
Prior mean, only required for |
priorSD |
Prior standard deviation / spread, only required for
|
A support interval with support level is defined by the
parameter values
for which the Bayes factor
contrasting
to
is larger or
equal than
, i.e., the parameter values for which the data are at
least
times more likely than under the alternative. Different
prior distributions for the parameter
under the
alternative
are available:
method = "SI-normal"
: a normal prior centered around
priorMean
with standard deviation priorSD
, i.e.,
method = "SI-normal-local"
: a local normal prior with standard
deviation priorSD
, i.e.,
method = "SI-normal-nonlocal"
: a nonlocal normal moment prior with
spread parameter priorSD
, i.e., a prior with density
The function also allows to compute minimum support intervals which require to only specify a class of priors for the parameter under the alternative and then compute the minimum Bayes factor over the class of alternatives. The following classes of prior distribution are available:
method = "mSI-all"
: the class of all prior distributions under the
alternative, this leads to the narrowest support interval possible
method = "mSI-normal-local"
: the class of local normal prior
distributions under the alternative, i.e., with
method = "mSI-eplogp"
: the class of monotonically decreasing beta
prior distributions on the p-value of the data , i.e.
with
Returns an object of class "supInt"
which is a list
containing:
si |
The computed support interval. |
bfFun |
The computed Bayes factor function. |
estimate |
The specified parameter estimate. |
se |
The specified standard error. |
siLevel |
The specified support level. |
ciLevel |
The specified confidence level. |
priorParams |
The specified prior parameters. |
Samuel Pawel
Pawel, S., Ly, A., and Wagenmakers, E.-J. (2023). Evidential Calibration of Confidence Intervals. The American Statistician. doi:10.1080/00031305.2023.2216239
Wagenmakers, E.-J., Gronau, Q. F., Dablander, F., and Etz, A. (2020). The support interval. Erkenntnis. doi:10.1007/s10670-019-00209-z
## confidence interval of hazard ratio needs to be transformed to log-scale ciHR <- c(0.75, 0.93) ci <- log(ciHR) ## normal prior under the alternative hypothesis H1 m <- log(0.8) # prior mean s <- 2 # prior sd ## compute 10 support interval si <- ciCalibrate(ci = ci, method = "SI-normal", priorMean = m, priorSD = s, siLevel = 10) si # on logHR scale exp(si$si) # on HR scale ## plot Bayes factor function and support interval plot(si) ## minimum support interval based on local normal priors msi <- ciCalibrate(ci = ci, method = "mSI-normal-local") plot(msi)
## confidence interval of hazard ratio needs to be transformed to log-scale ciHR <- c(0.75, 0.93) ci <- log(ciHR) ## normal prior under the alternative hypothesis H1 m <- log(0.8) # prior mean s <- 2 # prior sd ## compute 10 support interval si <- ciCalibrate(ci = ci, method = "SI-normal", priorMean = m, priorSD = s, siLevel = 10) si # on logHR scale exp(si$si) # on HR scale ## plot Bayes factor function and support interval plot(si) ## minimum support interval based on local normal priors msi <- ciCalibrate(ci = ci, method = "mSI-normal-local") plot(msi)
"supInt"
Plots Bayes factor function and support interval at the specified support level.
## S3 method for class 'supInt' plot(x, xlim = x$estimate + c(-1, 1) * 3 * x$se, ...)
## S3 method for class 'supInt' plot(x, xlim = x$estimate + c(-1, 1) * 3 * x$se, ...)
x |
Object of class |
xlim |
Limits of x-axis |
... |
Other arguments passed to |
Generates a plot of the Bayes factor function with support interval
Samuel Pawel
## compute 3 support interval si3 <- ciCalibrate(ci = c(0.3, 1.5), method = "SI-normal", priorMean = 0, priorSD = 2, siLevel = 3) ## plot Bayes factor function and support interval plot(si3, xlim = c(0, 1.75))
## compute 3 support interval si3 <- ciCalibrate(ci = c(0.3, 1.5), method = "SI-normal", priorMean = 0, priorSD = 2, siLevel = 3) ## plot Bayes factor function and support interval plot(si3, xlim = c(0, 1.75))
"supInt"
Prints parameter estimate, confidence interval, and support interval.
## S3 method for class 'supInt' print(x, ...)
## S3 method for class 'supInt' print(x, ...)
x |
Object of class |
... |
Other arguments (for consistency with the generic) |
Prints text summary in the console and invisibly returns the
"supInt"
object
Samuel Pawel
## compute and print 5 support interval si5 <- ciCalibrate(ci = c(-2, -0.5), method = "SI-normal", priorMean = -0.3, priorSD = 2, siLevel = 5) print(si5)
## compute and print 5 support interval si5 <- ciCalibrate(ci = c(-2, -0.5), method = "SI-normal", priorMean = -0.3, priorSD = 2, siLevel = 5) print(si5)