mcnemar.pow: Calculate Power for McNemar's Test

View source: R/mcnemar.pow.R

mcnemar.powR Documentation

Calculate Power for McNemar's Test

Description

Given a specified alternative distribution, this function computes the exact power for NcNemar's Test

Usage

mcnemar.pow(n, pdisc, delta, alpha = 0.025)

Arguments

n

The total sample size

pdisc

The combined proportion of discordant pairs

delta

The difference in the discordant cell rates (factor 1 pos and factor 2 neg minus factor 1 neg and factor 2 pos.

alpha

The one-sided type I error of the test

Details

When two binary (for convenience, called positive vs. negative) factors are measured on the same set of subjects, McNemar's test can be used to test whether the marginal proportions positive for the two factors are the same. For example, this could be of interest if the same quantity is measured before and after treatment, or if two different assays supposedly measuring the same quantity are being compared.

For the values of the two factors, let p11=the proportion of the n subjects positive for both, p22= the proportion negative for both, p12=the proportion positive for factor 1 and negative for 2, and p21= the proportion negative for 1 and positive for 2, where then p11+p22+p21+p12=1. In terms of these parameters, the input quantities are pdisc = p12+p21 and delta = p12-p21. If an alternative with p21>p12 is of interest, then delta should be negative.

McNemar's test is a conditional test of H0: p12=p21 (or equivalently the marginal probabilities p11+p12 = p11+p21) based on the discordant pairs. For the exact conditional test of one-sided size alpha, this function uses the marginal distribution of the number of discordant pairs under the specified distribution and the conditional distribution of the number positive for factor 1 and negative for factor 2 under the null and the alternative to determine the critical region of the test (under the null) and the exact unconditional power (under the specified alternative).

Value

A vector giving the values of n, p12, p21, the attained exact size, the exact power, and Mietinen's approximation (Biometrics, 1968, p343) to the power.

Author(s)

Bob Gray

Examples

mcnemar.pow(100, 0.9, 0.2, delta = 0.095)


raredd/desmon documentation built on May 7, 2024, 3:46 p.m.