R: Internal functions for exact2x2. Not to be called by user.

exact2x2-internal {exact2x2} | R Documentation

## Internal functions for exact2x2. Not to be called by user.

### Description

The function `exact2x2Pvals` can calculate p-values for a vector of odds ratios. The function `exact2x2CI` is the code that calculates the confidence intervals for the two-sided Fisher's exact test and Blaker's exact test. The functions `binomMeldCalcInt` and `binomMeldCalcMC` are called by `binomMeld.test`.

### Usage

    fisherCalcMidp(x,or,alternative,conf.int,conf.level)
    exact2x2Pvals(x, or, relErr=1+10^(-7),tsmethod = "minlike", alternative="two.sided")
    exact2x2CI(x, tsmethod="minlike", conf.level=0.95, tol=0.00001, orRange=c(10^-10,10^10))
    mcnemar.exact.calc(bb,cc,or,alternative,tsmethod="central",conf.level=.95, midp=FALSE)
    binomMeldCalcInt(x1,n1,x2,n2,nullparm=NULL,
               parmtype=c("difference","oddsratio","ratio"),
               conf.level=0.95, conf.int=TRUE,
               alternative=c("two.sided","less","greater"), midp=FALSE, eps=10^-8)
    binomMeldCalcMC(x1,n1,x2,n2,nullparm=NULL,
                               parmtype=c("difference","oddsratio","ratio"),
                               conf.level=0.95, conf.int=TRUE,
                               alternative=c("two.sided","less","greater"),
                               midp=FALSE,nmc=10^6)

### Arguments

`x` | matrix representing 2 by 2 table
`or` | odds ratio, may be a vector
`relErr` | relative error. This is used to handle true ties on the computer. (see details).
`tsmethod` | either "minlike","blaker", "central"
`conf.int` | logical, calculate CI?
`conf.level` | confidence level
`tol` | tolerance
`orRange` | range for search for odds ratio confidence interval
`alternative` | indicates the alternative hypothesis and must be one of `"two.sided"`, `"greater"` or `"less"`.
`midp` | logical. Do midp adjustment?

### Details

P-values for both the two-sided Fisher's exact and Blaker's exact test add probabilities from the opposite tail if either the cumulative probabilities (for Blaker's test) or the probabilities (Fisher's test) are less than or equal to those of the observed tail. Since sometimes the p-value at odds ratio=1 is important, we may have problems if the opposite tail is some very small different probability due to computer rounding, when mathematically the probabilities are exactly the same and should be included. To get around this problem `fisher.test` uses relErr so that it chooses all d<= d[i]*relErr and if mathematically d[i] is equal to another value in d but there is a slightly computer rounding error, that value will be included. We use the same tactic here.

The function `mcnemar.exact.calc` is just a simple call to `binom.test` with `p=.5`.

### Value

Output from `exact2x2Pvals` is a LIST, with

`or` | vector of odds ratios
`pvals` | vector of two-sided p-values

Output from `exact2x2CI` is a confidence interval with attributes: conf.level and conf.int.prec (a list of the bounds on the precision of the limits).

### See Also

`exact2x2`

[Package exact2x2 version 1.6.3 Index]