| Title: | Confidence Interval Estimation via CDF Inversion |
|---|---|
| Description: | Estimation of one- and two-sided confidence intervals via the numerical inversion of the cumulative distribution function of a statistic's sampling distribution. For more details, see section 9.2.3 of Casella and Berger (2002) <ISBN:0534243126>. |
| Authors: | Peter E. Freeman [aut, cre] |
| Maintainer: | Peter E. Freeman <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-16 06:06:27 UTC |
| Source: | https://github.com/cran/cdfinv |
cdfinv() returns one- or two-sided confidence interval estimates.
cdfinv( DISTR, PARAM, STAT, lpb = -10000, upb = 10000, bound = "two-sided", alpha = 0.05, tolb = 1e-06, tol = 1e-06, ... )cdfinv( DISTR, PARAM, STAT, lpb = -10000, upb = 10000, bound = "two-sided", alpha = 0.05, tolb = 1e-06, tol = 1e-06, ... )
DISTR |
name of sampling distribution in R |
PARAM |
name of distribution parameter for which we are computing an interval estimate |
STAT |
observed value of the chosen statistic |
lpb |
lower bound of search interval |
upb |
upper bound of search interval |
bound |
one of "two-sided", "lower", or "upper" |
alpha |
the confidence coefficient is 1 - alpha |
tolb |
search interval bound offset value |
tol |
convergence tolerance for uniroot function |
... |
additional arguments for DISTR's cdf function |
A list with interval bounds and associated cdf values.
DISTR - The distribution name (as given in R)
PARAM - The parameter name (as given in R)
STAT - The observed statistic value
bound - The interval bound(s)
q - The cdf quantile(s) associated with the interval bound(s)
Peter E. Freeman, [email protected]
cdfinv("norm","mean",3.45,sd=2) ## returns -0.4699279 and 7.3699277 cdfinv("gamma","rate",12.25,lpb=0,bound="upper",shape=10) ## returns 1.282058 cdfinv("nbinom","prob",22,lpb=0,upb=1,bound="lower",size=10) ## returns 0.1803843cdfinv("norm","mean",3.45,sd=2) ## returns -0.4699279 and 7.3699277 cdfinv("gamma","rate",12.25,lpb=0,bound="upper",shape=10) ## returns 1.282058 cdfinv("nbinom","prob",22,lpb=0,upb=1,bound="lower",size=10) ## returns 0.1803843
cdfinv.sim() returns one- or two-sided confidence interval estimates.
cdfinv.sim( DISTR, PARAM, STAT, lpb = -10000, upb = 10000, bound = "two-sided", alpha = 0.05, tolb = 1e-06, tol = 1e-06, seed = 1, numsim = 1e+05, nsamp = 1, stat.func = mean, ... )cdfinv.sim( DISTR, PARAM, STAT, lpb = -10000, upb = 10000, bound = "two-sided", alpha = 0.05, tolb = 1e-06, tol = 1e-06, seed = 1, numsim = 1e+05, nsamp = 1, stat.func = mean, ... )
DISTR |
name of distribution (in R) from which each datum is sampled |
PARAM |
name of distribution parameter for which we are computing an interval estimate |
STAT |
observed value of the chosen statistic |
lpb |
lower bound of search interval |
upb |
upper bound of search interval |
bound |
one of "two-sided", "lower", or "upper" |
alpha |
the confidence coefficient is 1 - alpha |
tolb |
search interval bound offset value |
tol |
convergence tolerance for uniroot function |
seed |
random number generator seed |
numsim |
number of simulated datasets |
nsamp |
sample size for each simulated dataset |
stat.func |
pointer to function computing the statistic for each dataset |
... |
additional arguments for DISTR's cdf function |
A list with interval bounds and associated cdf values.
DISTR - The distribution name (as given in R)
PARAM - The parameter name (as given in R)
STAT - The observed statistic value
bound - The interval bound(s)
q - The cdf quantile(s) associated with the interval bound(s)
Peter E. Freeman, [email protected]
ci_plot() creates a plot showing the cumulative distribution function(s) for the sampling distribution(s) of the chosen statistic, evaluated at the interval bound(s). The horizontal dashed line(s) show(s) the assumed quantile(s) (e.g., 0.95 for a 95% lower-bound), while the vertical dashed line shows the statistic value.
ci_plot(cdfinv.out, ...)ci_plot(cdfinv.out, ...)
cdfinv.out |
output list from cdfinv() |
... |
those additional arguments that were passed to cdfinv() |
None
Peter E. Freeman, [email protected]
ci_plot(cdfinv("norm","mean",2.5,sd=3),sd=3)ci_plot(cdfinv("norm","mean",2.5,sd=3),sd=3)
Computes the quantile of the chi-square distribution for n-1 degrees of freedom corresponding to the input value of the sample variance.
pnormvar(q, sigma2, n)pnormvar(q, sigma2, n)
q |
coordinate at which the cdf is to be evaluated (named in accordance with R standards) |
sigma2 |
the assumed normal variance |
n |
the sample size (pass this as an extra argument to cdfinv()) |
Do not call pnormvar() directly. Pass DISTR="normvar" to cdfinv() when computing intervals for the normal variance. The parameter name to be passed to cdfinv() is sigma2. The additional argument n (sample size) is to be passed to cdfinv().
The quantile of the chi-square distribution for n-1 degrees of freedom corresponding to the input value of the sample variance.
Peter E. Freeman, [email protected]
cdfinv("normvar","sigma2",14.35,lpb=0,n=22) ## returns 8.493787 29.305942cdfinv("normvar","sigma2",14.35,lpb=0,n=22) ## returns 8.493787 29.305942
Computes the quantile of the t distribution for n-1 degrees of freedom corresponding to the input value of the sample mean.
ptmean(q, mean, s2, n)ptmean(q, mean, s2, n)
q |
coordinate at which the cdf is to be evaluated (named in accordance with R standards) |
mean |
the assumed normal mean |
s2 |
the observed sample variance (pass this as an extra argument to cdfinv()) |
n |
the sample size (pass this as an extra argument to cdfinv()) |
Do not call ptmean() directly. Pass DISTR="tmean" to cdfinv() when computing intervals for the normal mean when the variance is unknown. The parameter name to be passed to cdfinv() is mean. The additional arguments s2 (sample variance) and n (sample size) are to be passed to cdfinv().
The quantile of the t distribution for n-1 degrees of freedom corresponding to the input value of the sample mean.
Peter E. Freeman, [email protected]
cdfinv("tmean","mean",14.35,s2=4.5,n=22) ## returns 13.40946 15.29054cdfinv("tmean","mean",14.35,s2=4.5,n=22) ## returns 13.40946 15.29054
Computes the value of sample variance corresponding to the input quantile p of the chi-square distribution for n-1 degrees of freedom
qnormvar(p, sigma2, n)qnormvar(p, sigma2, n)
p |
the cdf value (named in accordance with R standards) |
sigma2 |
the assumed normal variance |
n |
the sample size (pass this as an extra argument to cdfinv()) |
Do not call qnormvar() directly. Pass DISTR="normvar" to cdfinv() when computing intervals for the normal variance. The parameter name to be passed to cdfinv() is sigma2. The additional argument n (sample size) is to be passed to cdfinv().
The value of sample variance corresponding to the input quantile p of the chi-square distribution for n-1 degrees of freedom
Peter E. Freeman, [email protected]
Computes the value of sample mean corresponding to the input quantile p of the t distribution for n-1 degrees of freedom
qtmean(p, mean, s2, n)qtmean(p, mean, s2, n)
p |
value of cdf (named in accordance with R standards) |
mean |
the assumed normal mean |
s2 |
the observed sample variance (pass this as an extra argument to cdfinv()) |
n |
the sample size (pass this as an extra argument to cdfinv()) |
Do not call qtmean() directly. Pass DISTR="tmean" to cdfinv() when computing intervals for the normal mean when the variance is unknown. The parameter name to be passed to cdfinv() is mean. The additional arguments s2 (sample variance) and n (sample size) are to be passed to cdfinv().
The value of sample mean corresponding to the input quantile p of the t distribution for n-1 degrees of freedom
Peter E. Freeman, [email protected]