EffectSize_Means: Determining required effect size with two means of equal n

Description Usage Arguments Details Examples

View source: R/EffectSize_Means.R

Description

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

Usage

1
2
3
EffectSize_Means(n = NULL, populationmean = NULL, populationdev = 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).

populationmean

The population mean for the statistic in question. Required for all analyses.

populationdev

The population standard deviation for the statistic in question. Required for all analyses.

alternative

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

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 means in observed units, unlike Cohen's d. 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 .9 of the treatment group receives treatment, the required effect size among those .9 treated becomes .1/.9 = .11.

"d" refers to Cohen's d, the formal score for effect size in tests of two means. In the output, Cohen's d is calculated after taking treatment rate into effect - it is the d for the full treatment group, including those who do not receive treatment. If the treatment rate is lower than 1, d 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 required effect size given n, etc
EffectSize_Means(n = 100, populationmean = 50, populationdev = 10, alternative = "greater", treatmentrate = .8)

#Determining required effect size across multiple n's
EffectSize_Means(n = c(100, 200, 300), populationmean = 50, populationdev = 10, alternative = "greater", treatmentrate = .8)

#Assigning (unrounded) required effect size
e <- EffectSize_Means(n = 100, populationmean = 50, populationdev = 10, alternative = "greater", treatmentrate = .8)
e

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