Description Usage Arguments Details Examples

View source: R/SampleSize_Means.R

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

1 2 3 |

`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. |

`effectsize` |
The difference in means between the treatment group and the base rate. Can be a single integer |

`alternative` |
The type of hypothesis. Can be |

`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 |

`power` |
The power of the hypothetical test. Defaults to |

`d` |
Refers to Cohen's d, the formal score for effect size in tests of means. You may supply a Cohen's d score instead of a practical effect size if you prefer. |

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 sample size. Assuming that those who do not receive treatment will be identical to the control group, the required sample size will need to be inversely proportional to the treatment rate. That is, a completed treatment is worth an effect size of 1, but only 90 for the treatment group will only be .9. This means that the n will need to be higher than it would if the treatment rate was 1.

In the output, Cohen's d is calculated after taking treatment rate into effect. If the treatment rate given to the function is lower than 1, the d supplied will also be lower, even if all other numbers are constant.

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

1 2 3 4 5 6 7 8 9 10 11 | ```
Please refer to vignette for detailed examples.
#Determining required per-group sample given effect size, etc
SampleSize_Means(populationmean = 100, populationdev = 30, effectsize = -20, treatmentrate = .9)
#Determining required per-group sample size across multiple effect sizes
SampleSize_Means(populationmean = 100, populationdev = 30, effectsize = c(-20, -10, -5), treatmentrate = .9)
#Assigning (unrounded) required sample size
n <- SampleSize_Means(populationmean = 100, populationdev = 30, effectsize = c(-20, -10, -5), treatmentrate = .9)
n
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.