EffectSize_Proportions: Determining required effect size with two proportions of...

Description Usage Arguments Details Examples

View source: R/EffectSize_Proportions.R

Description

This function runs power calculations with two proportions of equal n, determining what effect size is necessary to see a statistically significant effect. Results are printed and can also be assigned.

Usage

1
2
3
EffectSize_Proportions(n = NULL, baserate = NULL,
  alternative = c("two.sided", "less", "greater"), treatmentrate = 1,
  sig.level = 0.05, power = 0.8)

Arguments

n

The per-group sample size. Can be a single integer n or a combination of integers c(n1, n2, etc).

baserate

The base rate for the population and probability in question. Required for all analyses.

alternative

The type of hypothesis. Can be "greater" (p1 > p2), "less" (p1 < p2), or "two.sided" (p1 != p2).

treatmentrate

The proportion of those in the treatment group who are expected to complete treatment; see details.

sig.level

The significance level of the hypothetical test. Defaults to 0.05.

power

The power of the hypothetical test. Defaults to 0.8.

Details

The effect size input is a "practical" effect size in that it is the difference in observed probabilities, unlike Cohen's h. The calculations adjust for treatment rate, so consider the effect size the mean effect among those who successfully receive treatment.

The treatment rate is used to (crudely) calculate the effect size. Assuming that those who do not receive treatment will be identical to the control group, the required effect size will need to be inversely proportional to the treatment rate. That is, if an effect of .1 is needed to see a significant effect, and only 90 effect size among those 90

"h" refers to Cohen's h, the formal score for effect size in tests of two means. In the output, Cohen's h is calculated after taking treatment rate into effect - it is the h for the full treatment group, including those who do not receive treatment. If the treatment rate is lower than 1, h will be lower.

Printed value is rounded; for an unrounded value, assign output to an object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Please refer to vignette for detailed examples.

#Determining effect size given n, etc
EffectSize_Proportions(n = 100, baserate = .5, alternative = "greater", treatmentrate = .8)

#Determining required effect size across multiple n's
EffectSize_Proportions(n = c(100, 200, 300), baserate = .5, alternative = "greater", treatmentrate = .8)
 
#Assigning (unrounded) required effect size
e <- EffectSize_Proportions(n = 100, baserate = .5, alternative = "greater", treatmentrate = .8)
e

isaacahuvia/QuickPower documentation built on May 6, 2019, 11:30 a.m.