Package 'ExactCIone'

Title: Admissible Exact Intervals for One-Dimensional Discrete Distributions
Description: Construct the admissible exact intervals for the binomial proportion, the Poisson mean and the total number of subjects with a certain attribute or the total number of the subjects for the hypergeometric distribution. Both one-sided and two-sided intervals are of interest. This package can be used to calculate the intervals constructed methods developed by Wang (2014) <doi:10.5705/ss.2012.257> and Wang (2015) <doi:10.1111/biom.12360>.
Authors: Chongxiu Yu [aut, cre], Weizhen Wang [aut], Zhongzhan Zhang [aut]
Maintainer: Chongxiu Yu <[email protected]>
License: AGPL (>= 3)
Version: 1.0.5
Built: 2024-12-03 07:00:12 UTC
Source: CRAN

Help Index


An Admissible Exact Confidence Interval for the Bnomial Proportion

Description

An admissible exact confidence interval of level 1-alpha is constructed for the binomial proportion p. This function can be used to calculate the interval constructed method proposed by Wang (2014).

Usage

WbinoCI(x, n, conf.level = 0.95, details = FALSE)

Arguments

x

the number of success or the observed data.

n

the sample size.

conf.level

Confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence interval for the whole sample points and output the infimum coverage probability. The default is FALSE.

Details

Suppose X~bino(n,p), the sample space of X is {0,1,...,n}. Wang (2014) proposed an admissible interval which is obtained by uniformly shrinking the initial 1-alpha Clopper-Pearson interval from the middle to both sides of the sample space iteratively. This interval is admissible so that any proper sub-interval of it cannot assure the confidence coefficient. This means the interval cannot be shortened anymore.

Value

A list which contains the confidence interval (CI) of the sample point and the confidence intervals (CIM) for all the points and the icp.

References

Clopper, C. J. and Pearson, E. S. (1934). The use of confidence or fiducial limits in the case of the binomial. "Biometrika" 26: 404-413.

Wang, W. (2014). An iterative construction of confidence intervals for a proportion. "Statistica Sinica" 24: 1389-1410.

Examples

WbinoCI(x=2,n=5,conf.level=0.95,details=TRUE)
WbinoCI(x=2,n=5,conf.level=0.95)

An Admissible Exact Lower Interval for the Binomial Proportion

Description

The 1-alpha Clopper-Pearson lower interval for the binomial proportion p.

Usage

WbinoCI_lower(x, n, conf.level = 0.95, details = FALSE)

Arguments

x

the number of success or the observed data.

n

the sample size.

conf.level

Confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence interval for the whole sample points. The default is FALSE.

Value

A list which contains the confidence interval (CI) of the sample point and the confidence intervals (CIM) for all the points.

References

Clopper, C. J. and Pearson, E. S. (1934). The use of confidence or fiducial limits in the case of the binomial. "Biometrika" 26: 404-413.

Examples

WbinoCI_lower(x=2,n=5,conf.level=0.95,details=TRUE)
WbinoCI_lower(x=2,n=5,conf.level=0.95)

An Admissible Exact Upper Interval for the Binomial Proportion

Description

The 1-alpha Clopper-Pearson upper interval for the binomial proportion p.

Usage

WbinoCI_upper(x, n, conf.level = 0.95, details = FALSE)

Arguments

x

the number of success or the observed data.

n

the sample size.

conf.level

Confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence interval for the whole sample points. The default is FALSE.

Value

A list which contains the confidence interval (CI) of the sample point and the confidence intervals (CIM) for all the points.

References

Clopper, C. J. and Pearson, E. S. (1934). The use of confidence or fiducial limits in the case of the binomial. "Biometrika" 26: 404-413.

Examples

WbinoCI_upper(x=2,n=5,conf.level=0.95,details=TRUE)
WbinoCI_upper(x=2,n=5,conf.level=0.95)

An Admissible Exact Confidence Interval for M, the Number of White Balls in an Urn

Description

The confidence interval for the number of white balls in an urn that contains M white balls and N-M black balls when sampling without replacement. This function can be used to calculate the interval constructed method proposed by Wang (2015).

Usage

WhyperCI_M(x, n, N, conf.level, details = FALSE)

Arguments

x

integer representing the number of white balls in the drawn balls.

n

integer representing the number of balls we draw in the urn without replacement, i.e., the sample size.

N

integer representing the number of all balls in an urn, i.e., the population size.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. If choose FALSE, the confidence interval at the observed X will be returned. If choose TRUE, the confidence intervals for all sample points and the infimum coverage probability will be returned. Default is FALSE.

Details

Suppose X~Hyper(M,N,n). When N and n are known, Wang (2015) construct an admissible confidence interval for N by uniformly shrinking the initial 1-alpha Clopper-Pearson type interval from the mid-point of the sample space to 0. This interval is admissible so that any proper sub-interval of it cannot assure the confidence coefficient. This means the interval cannot be shortened anymore.

Value

a list which contains i) the confidence interval for M, ii)the confidence interval for p=M/N (this interval is equal to the previous interval divided by N) and iii) the infimum coverage probability of the two intervals.

References

Wang, W. (2015). Exact Optimal Confidence Intervals for Hypergeometric Parameters. "Journal of the American Statistical Association" 110 (512): 1491-1499.

Examples

WhyperCI_M(0,50,2000,0.95,details = TRUE)
WhyperCI_M(0,50,2000,0.95)

An Admissible Exact One-sided Lower Interval for the Number of White Balls in Hypergeometric Distribution

Description

The 1-alpha Clopper-Pearson type lower interval for the number of white balls in an urn.

Usage

WhyperCI_M_lower(X, n, N, conf.level, details = FALSE)

Arguments

X

integer representing the number of white balls we observed when drawn without replacement from an urn which contains both black and white balls.

n

the number we drawn.

N

integer representing the number of the whole balls in an urn.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. Default is FALSE. If choose TRUE, the confidence intervals for the whole sample space and the icp will be returned.

Value

a list which contains the confidence interval.

References

Konijn, H. S. (1973). Statistical Theory of Sample Survey Design and Analysis, Amsterdam: North-Holland.

Examples

WhyperCI_M_lower(0,50,2000,0.95,details = TRUE)
WhyperCI_M_lower(0,50,2000,0.95)

An Admissible Exact One-sided Upper Interval for the Number of White Balls in Hypergeometric Distribution

Description

The 1-alpha Clopper-Pearson type upper interval for the number of white balls in an urn.

Usage

WhyperCI_M_upper(X, n, N, conf.level, details = FALSE)

Arguments

X

integer representing the number of white balls we observed when drawn without replacement from an urn which contains both black and white balls.

n

the number we drawn.

N

integer representing the number of the whole balls in an urn.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. Default is FALSE. If choose TRUE, the confidence intervals for the whole sample space and the icp will be returned.

Value

a list which contains the confidence interval.

References

Konijn, H. S. (1973). Statistical Theory of Sample Survey Design and Analysis, Amsterdam: North-Holland.

Examples

WhyperCI_M_upper(0,50,2000,0.95,details = TRUE)
WhyperCI_M_upper(0,50,2000,0.95)

An Admissible Exact Confidence Interval for N, the Number of Balls in an Urn.

Description

An admissible exact confidence interval for the number of balls in an urn, which is the population number of a hypergeometric distribution. This function can be used to calculate the interval constructed method proposed by Wang (2015).

Usage

WhyperCI_N(x, n, M, conf.level, details = FALSE)

Arguments

x

integer representing the number of white balls in the drawn balls.

n

integer representing the number of balls we draw in the urn without replacement, i.e., the sample size.

M

the number of white balls in the urn.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. If choose FALSE, the confidence interval at the observed X will be returned. If choose TRUE, the confidence intervals for all sample points and the infimum coverage probability will be returned. Default is FALSE.

Details

Suppose X~Hyper(M,N,n). When M and n are known, Wang (2015) construct an admissible confidence interval for N by uniformly shrinking the initial 1-alpha Clopper-Pearson type interval from 0 to min(M,n). This interval is admissible so that any proper sub-interval of it cannot assure the confidence coefficient. This means the interval cannot be shortened anymore.

Value

a list which contains i) the confidence interval for N and ii) the infimum coverage probability of the intervals.

References

Wang, W. (2015). Exact Optimal Confidence Intervals for Hypergeometric Parameters. "Journal of the American Statistical Association" 110 (512): 1491-1499.

Examples

WhyperCI_N(10,50,800,0.95,details=TRUE)
WhyperCI_N(50,50,800,0.95)

An Admissible Exact One-sided Lower Interval for the Population Number of Hypergeometric Distribution

Description

The 1-alpha Clopper-Pearson type lower interval for the population number of hypergeometric distribution.

Usage

WhyperCI_N_lower(x, n, M, conf.level, details = FALSE)

Arguments

x

integer representing the number of white balls we observed when drawn without replacement from an urn which contains both black and white balls.

n

the number we drawn.

M

the number of the white balls.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. Default is FALSE. If choose TRUE, the confidence intervals for the whole sample space will be returned.

Value

a list which contains the confidence interval.

References

Konijn, H. S. (1973). Statistical Theory of Sample Survey Design and Analysis, Amsterdam: North-Holland.

Examples

WhyperCI_N_lower(0,50,800,0.95,details=TRUE)
WhyperCI_N_lower(0,50,800,0.95)

An Admissible Exact One-sided Upper Interval for the Population Number of Hypergeometric Distribution

Description

The 1-alpha Clopper-Pearson type upper interval for the population number of hypergeometric distribution.

Usage

WhyperCI_N_upper(x, n, M, conf.level, details = FALSE)

Arguments

x

integer representing the number of white balls we observed when drawn without replacement from an urn which contains both black and white balls.

n

the number we drawn.

M

the number of the white balls.

conf.level

the confidence level of confidence interval.

details

TRUE/FALSE, can be abbreviate. Default is FALSE. If choose TRUE, the confidence intervals for the whole sample space will be returned.

Value

a list which contains the confidence interval.

References

Konijn, H. S. (1973). Statistical Theory of Sample Survey Design and Analysis, Amsterdam: North-Holland.

Examples

WhyperCI_N_upper(0,50,800,0.95,details=TRUE)
WhyperCI_N_upper(0,50,800,0.95)

An Admissible Exact Confidence Interval for the Poisson Mean

Description

An admissible exact confidence interval for the Poisson mean. This function can be used to calculate the interval constructed method proposed by Wang (2014).

Usage

WpoisCI(x, conf.level = 0.95, details = FALSE)

Arguments

x

the sample or the observed point.

conf.level

confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence intervals for all the sample points. Default is FALSE.

Details

Suppose X~poi(lambda), the sample space of X is {0,1,...}. Wang (2014) proposed an admissible interval which is obtained by uniformly shrinking the initial 1-alpha Clopper-Pearson interval from 0 to the sample point of interest. This interval is admissible so that any proper sub-interval of it cannot assure the confidence coefficient. This means the interval cannot be shortened anymore.

Value

a list which contain the confidence interval and the ICP.

References

Wang, W. (2014). An iterative construction of confidence intervals for a proportion. "Statistica Sinica" 24: 1389-1410.

Examples

WpoisCI(1)
WpoisCI(3,details = TRUE)

An Admissible Exact One-sided Lower Confidence Interval for Poisson Mean

Description

The 1-alpha Clopper-Pearson type lower interval for the Poisson mean.

Usage

WpoisCI_lower(x, conf.level = 0.95, details = FALSE)

Arguments

x

the sample or the observed point.

conf.level

confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence intervals for all the sample points. Default is FALSE.

Value

a list which contain the one-sided lower confidence interval.

References

Garwood, F. (1936). Fiducial Limits for the Poisson Distribution. "Biometrika" 28: 437-442.

Examples

WpoisCI_lower(1)
WpoisCI_lower(3,details = TRUE)

An Admissible Exact One-sided Upper Confidence Interval for Poisson Mean

Description

The 1-alpha Clopper-Pearson type upper interval for the Poisson mean.

Usage

WpoisCI_upper(x, conf.level = 0.95, details = FALSE)

Arguments

x

the sample or the observed point.

conf.level

confidence level. The default is 0.95.

details

TRUE/FALSE, can be abbreviated. To choose whether to compute the confidence intervals for all the sample points. Default is FALSE.

Value

a list which contain the one-sided upper confidence interval.

References

Garwood, F. (1936). Fiducial Limits for the Poisson Distribution. "Biometrika" 28: 437-442.

Examples

WpoisCI_upper(1)
WpoisCI_upper(3,details = TRUE)