Estimate power for conflict effect using monte-carlo simulation, return table and plot

c_power_table(
  subjects,
  differences,
  c_nmst,
  nc_nmst,
  num_sims = 100,
  alpha = 0.05
)

Arguments

subjects

A vector for the numbers of subjects across simulated experiments

differences

A vector for the mean differences between conflict and no-conflict trials across simulations

c_nmst

A vector containing the parameters for an ex-gaussian distribution, c(n, mu, sigma, tau), where n is the number of trials.

nc_nmst

A vector containing the parameters for an ex-gaussian distribution, c(n, mu, sigma, tau), where n is the number of trials.

num_sims

A number, simulations to run

alpha

A number, alpha criterion

Value

A list, $power_table contains a table with power estimates as a function of number of subjects and mean differences, $power_curve contains a graph (using ggplot2) showing power as a function of subjects and mean differences

Details

This function is an extension to c_power_fast, that allows multiple estimates of power for a vector specifying numbers of subjects and mean differenes.

This function uses monte-carlo simulation to determine statistical power associated for detecting a conflict effect, and includes paramaters for number of subjects in the experiment, number of trials in each condition (conflict vs. no-conflict), and paramaters (mu,sigma,tau) for each reaction time distribution.

For every simulated experiment, a one sample t-test (two-tailed) is computed, and the p-value is saved. Power is the proportion of simulated experiments that return p-values less than the defined alpha criterion.

Examples

test <- c_power_table(subjects = c(10,20,30),
                differences = c(10,20,30),
                c_nmst = c(50,732.4,80.7,157.5),
                nc_nmst = c(50,625.4,68.6,166.3),
                num_sims = 100,
                alpha = .05)
#> Loading required package: ggplot2
test$power_table
#>   subjects differences power
#> 1       10          10  0.10
#> 2       20          10  0.05
#> 3       30          10  0.08
#> 4       10          20  0.10
#> 5       20          20  0.19
#> 6       30          20  0.45
#> 7       10          30  0.45
#> 8       20          30  0.73
#> 9       30          30  0.89
test$power_curve