power.multiCA.test: Power calculations for the multinomial Cochran-Armitage trend...

Description Usage Arguments Details Value Examples

View source: R/multiCA.R

Description

Given the probabilities of outcomes, compute the power of the overall multinomial Cochran-Armitage trend test or determine the sample size to obtain a target power.

Usage

1
2
3
power.multiCA.test(N = NULL, power = NULL, pmatrix = NULL, p.ave = NULL,
  p.start = NULL, p.end = NULL, slopes = NULL, scores = 1:G,
  n.prop = rep(1, G), G = length(p.ave), sig.level = 0.05)

Arguments

N

integer, the total sample size of the study. If NULL then power needs to be specified.

power

target power. If NULL then N needs to be specified.

pmatrix

numeric matrix of hypothesized outcome probabilities in each group, with #' the outcomes as rows and ordered groups as columns. The columns should add up to 1.

p.ave

numeric vector of average probability of each outcome over the groups weighted by n.prop.

p.start, p.end

numeric vectors of the probability of each outcome for the first / last ordered group

slopes

numeric vector of the hypothesized slope of each outcome when regressed against the column scores wiht weights n.prop

scores

non-decreasing numeric vector of the same length as the number of ordered groups giving the trend test scores. Defaults to linearly increasing values.

n.prop

numeric vector describing relative sample sizes of the ordered groups. Will be normalized to sum to 1. Defaults to equal sample sizes.

G

integer, number of ordered groups

sig.level

significance level

Details

The distribution of the outcomes can be specified in two ways: either the full matrix of outcome probabilities pmatrix can be specified, or exactly two of the parameters p.ave, slopes, p.start, and p.end must be specified, while

Value

object of class "power.htest"

Examples

1
2
3
4
5
6
7
power.multiCA.test(power=0.8, p.start=c(0.1,0.2,0.3,0.4), p.end=c(0.4, 0.3, 0.2, 0.1), 
                     G=5, n.prop=c(3,2,1,2,3))

## Power of stroke study with 100 subjects per year and observed trends
data(stroke)
strk.mat <- xtabs(Freq ~ Type + Year, data=stroke)
power.multiCA.test(N=900, pmatrix=prop.table(strk.mat, margin=2))

Example output

     Multinomial Cochran-Armitage trend test 

              n = 85.663
         n.prop = 0.27272727, 0.18181818, 0.09090909, 0.18181818, 0.27272727
          p.ave = 0.25, 0.25, 0.25, 0.25
         slopes = 0.075, 0.025, -0.025, -0.075
              G = 5
      sig.level = 0.05
          power = 0.8


     Multinomial Cochran-Armitage trend test 

              n = 900
         n.prop = 0.1111111, 0.1111111, 0.1111111, 0.1111111, 0.1111111, 0.1111111, 0.1111111, 0.1111111, 0.1111111
          p.ave = 0.29123780, 0.17669534, 0.30588688, 0.03757237, 0.18860761
         slopes = 0.004854911, 0.003100285, -0.017742374, 0.005732797, 0.004054381
              G = 9
      sig.level = 0.05
          power = 0.8291081

multiCA documentation built on May 2, 2019, 4:51 p.m.