Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

powerPaired2x2

Power for exact McNemar's test


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

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

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

exact2x2

Exact Tests and Confidence Intervals for 2x2 Tables

v1.6.5
GPL-3
Authors
Michael P. Fay [aut, cre], Sally A. Hunsberger [ctb], Martha Nason [ctb], Erin Gabriel [ctb], Keith Lumbard [ctb]
Initial release
2020-08-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.