powerPaired2x2: Power for exact McNemar's test

Description Usage Arguments Details Value Examples

View source: R/powerPaired2x2.R

Description

Calculate the power for the exact McNemar's test (i.e., exact2x2 with paired=TRUE) given the number of pairs and the probability of a positive response only in the test individual in the pair (pb), and the probability of a positive response only in the control individual in the pair (pc).

Usage

1
2
3
powerPaired2x2(pb, pc, npairs, sig.level = 0.05, 
   alternative = c("two.sided", "one.sided"), 
   strict = FALSE, nullOddsRatio = 1, errbound = 10^-6, ...)

Arguments

pb

probability of a (0,1) response for a pair, meaning negative response in the control individual and a positive response in the test individual

pc

probability of a (1,0) response for a pair, meaning positive response in the control individual and a negative response in the test individual

npairs

the number of pairs

sig.level

significance level (also called alpha-level)

alternative

either 'one.sided' or 'two.sided' (see tsmethod for two-sided method)

strict

use strict interpretation in two-sided case (i.e., TRUE allows rejections in the 'wrong' direction)

nullOddsRatio

null odds ratio, internally passed to or argument of exact2x2 with paired=TRUE

errbound

error bound, errbound=0 does exact calculation, when errbound>0 then speed up calculations by not calculating outcomes at either extreme with tail probabilities less than errbound/2 which may underestimate power by at most errbound.

...

arguments passed to exact2x2 (except these arguments cannot be passed this way: or, alternative, conf.int, paired, plot)

Details

When alternative='one.sided' then the test automatically picks the side that is most powerful.

Value

An object of class 'power.htest' with elements:

power

power

npairs

number of pairs

pb

probability of a (control,test)=(0,1) response for a pair

pc

probability of a (control,test)=(1,0) response for a pair

sig.level

significance level or alpha-level

alternative

either one-sided or two-sided

nullOddsRatio

null odds ratio (or boundary between null and alternative for one-sided tests)

note

notes about calculation (e.g., errbound value)

method

description of method

Examples

1
powerPaired2x2(.5,.3,npairs=20)

Example output

Loading required package: exactci
Loading required package: ssanv

     Power for McNemar's Exact Test 

          power = 0.1191185
         npairs = 20
             pb = 0.5
             pc = 0.3
      sig.level = 0.05
    alternative = two.sided
  nullOddsRatio = 1

NOTE: errbound= 1e-06

exact2x2 documentation built on Dec. 11, 2021, 9:43 a.m.