power_sim: Run Power Simulations

Description Usage Arguments Value Examples

View source: R/power.R

Description

Run Power Simulations

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
power_sim(
  model,
  phase_eff,
  target_effect,
  nsubj,
  nruns,
  outfile = sprintf("%s_%s_%s_%04d_128_%05d_%s_%d.rds", model,
    sprintf("%0.2f~%0.2f~%0.2f~%0.2f", phase_eff[1], phase_eff[2], phase_eff[3],
    phase_eff[4]), target_effect, nsubj, nruns, Sys.info()[["nodename"]], Sys.getpid())
)

Arguments

model

Which type of model to fit: use 'lmem' for linear mixed-effects model and 'clmm' for cumulative link mixed-effects model.

phase_eff

A four-element vector, each element of which specifies the illusory truth effect at the corresponding phase, on the log odds scale (see gen_data).

target_effect

Which effect to test, the main effect ('main') or the interaction effect ('interaction').

nsubj

Number of subjects.

nruns

How many simulations to run.

outfile

Name of output file; NULL to return the simulation results.

Value

Either the name of the outfile (if outfile is non-null) or the results of the simulation (a matrix containing results of fit_lmem or fit_clmm).

Examples

1
2
set.seed(62)
power_sim("lmem", c(0, .14, .14, .14), "main", 40, 1, NULL)

truthiness documentation built on May 24, 2021, 9:07 a.m.