Package 'easypower'

Title: Sample Size Estimation for Experimental Designs
Description: Power analysis is used in the estimation of sample sizes for experimental designs. Most programs and R packages will only output the highest recommended sample size to the user. Often the user input can be complicated and computing multiple power analyses for different treatment comparisons can be time consuming. This package simplifies the user input and allows the user to view all of the sample size recommendations or just the ones they want to see. The calculations used to calculate the recommended sample sizes are from the 'pwr' package.
Authors: Aaron McGarvey
Maintainer: Aaron McGarvey <[email protected]>
License: GPL (>= 3)
Version: 1.0.2
Built: 2024-11-06 02:39:29 UTC
Source: https://github.com/cran/easypower

Help Index


Sample Size Calculations Using Power Analysis

Description

Power analysis is used in the estimation of sample sizes for experimental designs. Most programs and R packages will only output the highest recommended sample size to the user. Often the user input can be complicated and computing multiple power analyses for different treatment comparisons can be time consuming. This package simplifies the user input and allows the user to view all of the sample size recommendations or just the ones they want to see. Currently, one-way ANOVAs n.oneway and factorial ANOVAs n.multiway are supported. The effect size utilized by the functions is eta-squared which is equivalent to percentage variance. It is used in the input for all of the functions so that the user may use one standard effect size for all of their calculations. The calculations used to calculate the recommended sample sizes are from the 'pwr' package. Future updates are planned to add more experimental designs.

Details

Package: easypower
Type: Package
Version: 1.0.1
Date: 2015-11-04
License: GPL (>=3)

Author(s)

Author: Aaron McGarvey [email protected]
Maintainer: Aaron McGarvey [email protected]

Sample size calculations for factorial ANOVAs

Description

Sample size calculations for factorial ANOVAs

Usage

n.multiway(iv1 = NULL, iv2 = NULL, iv3 = NULL, iv4 = NULL,
  interaction.eta2 = "small", sig.level = 0.05, power = 0.8,
  result = "all", ...)

Arguments

iv1

The list of data for treatment 1.

iv2

The list of data for treatment 2.

iv3

(optional) The list of data for treatment 3.

iv4

(optional) The list of data for treatment 4.

interaction.eta2

(optional) Either a character string or numeric value of the desired eta squared. Default is set to "small".

sig.level

(optional) Desired significance level. Default value is 0.05.

power

(optional) Desired level of power. Default value is 0.80.

result

The amount of data that will be output to the user (default = "all"). The following are the three output options the user may specify:

  • result = "all" - Outputs the sample size recommendations for all treatments and all possible interactions.

  • result = "highest" - Outputs the highest recommended sample size.

  • result = "select" - Outputs specific results to the user. If there has been previous research on an effect, the user may input a numeric value for the effect size. The output will consist of the highest recommended sample size and the recommendations where the user input a numeric value for the effect size of a treatment.

...

Extra interactions to pass in. In order to change the effect size of a specific interaction an interaction effect may be added to the function. It must take the form: int# = int.eff.#.

Details

Acceptable effect size character string values and their numeric equivalents are: "small" (0.01), "med" (0.06), and "large" (0.14).

Note

Sample size recommendations are rounded up to the nearest integer. More detailed examples on n.multiway can be viewed in the vignette.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale, N.J.: Lawrence Erlbaum Associates.

Examples

# Exercise 8.15, p.400 from Cohen (1988)
# Defining the treatments
main.eff.1 <- list(name = "R", levels = 2, eta.sq = 0.123)
main.eff.2 <- list(name = "C", levels = 4, eta.sq = 0.215)
# Running n.multiway
n.multiway(iv1=main.eff.1, iv2=main.eff.2, interaction.eta2 = 0.079)
# To just view highest
n.multiway(iv1=main.eff.1, iv2=main.eff.2, interaction.eta2 = 0.079, result = "highest")

# Exercise 8.14, p.397 from Cohen (1988)
# Defining the treatments and interaction
main.eff.1 <- list(name = "Sex", levels = 2, eta.sq = 0.0099)
main.eff.2 <- list(name = "Age", levels = 3, eta.sq = 0.0588)
main.eff.3 <- list(name = "Conditions", levels = 4, eta.sq = 0.1506)
# Running n.multiway
n.multiway(iv1=main.eff.1, iv2=main.eff.2, iv3=main.eff.3, interaction.eta2 = 0.0588)

Calculates the required sample size for a one-way ANOVA.

Description

Calculates the required sample size for a one-way ANOVA.

Usage

n.oneway(iv = iv, sig.level = 0.05, power = 0.8)

Arguments

iv

List of data for the treatment to be tested.

sig.level

Desired significance level (default is 0.05).

power

Desired level of power (default is 0.80).

Value

Returns the recommended sample size given the conditions to achieve the desired power.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale, N.J.: Lawrence Erlbaum Associates.

Examples

# Exercise 8.10, p.391 from Cohen (1988)
main.eff <- list(name = "Teaching", levels = 4, eta.sq = 0.0588)
# Running the function with default settings
n.oneway(iv = main.eff)