q.samp.size.t: Sample size for comparing means

View source: R/q.samp.size.t.R

q.samp.size.tR Documentation

Sample size for comparing means

Description

Calculate sample size for a difference in mean based on pwr.t.test from the pwr package

Usage

q.samp.size.t(refmean=NULL, compmean=NULL, SD=NULL, dropout=0.2, arms=2, 
             sig.level = 0.05 , power = 0.8, type = "two.sample", 
             alternative ="two.sided")

Arguments

refmean

Mean for the product/intervention of interest

compmean

Mean for comparator/placebo

SD

Pooled standard deviation for calculation of Cohen's d

dropout

Dropout rate to be accounted for in sample size calculation. Default is 0.2

arms

Number of armes in the planned study

sig.level

Significance level. Default is 0.05

power

Power. Default is 0.8

type

A character string specifying the type of test. Options: "one.sample", "two.sample" (default) or "paired" (see pwr.t.test)

alternative

A charater string specifying the alternative hypothesis. Options: "two.sided" (default), "greater" or "less" (see pwr.t.test)

Value

A list containing the mean difference, mean ratio, number of completers per arm, total sample size per arm, total sample size for the study and number of study arms

Author(s)

Abdul Malik Sulley <asulley@uwo.ca> 22 April, 2020

See Also

pwr.t.test

Examples

sds <- c(21.1, 32.2, 43.3)
ns <- c(40, 37, 39)
SD <- q.pooled_sd(sds, ns)
refmean <- 57.2
compmean <- 22.8
q.samp.size.t(refmean, compmean, SD, dropout=0.2, 
type = "two.sample", alternative ="two.sided", arms=2 )

qwickmalik/qwickr documentation built on March 30, 2022, 2:59 p.m.