power_simulation: Function trunning the actual power simulation

View source: R/simulation_functions.R

power_simulationR Documentation

Function trunning the actual power simulation

Description

power_simulation() runs the actual simulation process for either the databased, SESOI, R2, safeguard or rnorm power option. Returns a data frame with results for all fixed effects and all tested sample sizes.

Usage

power_simulation(
  model,
  data,
  simvar,
  fixed_effects,
  critical_value,
  steps,
  n_sim,
  confidence_level,
  safeguard = F,
  rnorm = F,
  R2 = F,
  R2var,
  R2level,
  nCores
)

Arguments

model

lme4 model: mixed model of interest

data

data frame: pilot data that fits the mixed model of interest

simvar

charackter element: name of the variable that contains the subject??s number in data

fixed_effects

vector of character elements: names of variables that are used as fixed effects in model emp

critical_value

integer: z/t value to test if a given fixed effect is significant

n_sim

integer: number of simulations to run

safeguard

logical value: indicates whether safeguard power simulation shoul be run

rnorm

logical value: indicates whether rnorm power simulation shoul be run

R2

logical value: indicating if a R2 simulation should be run

R2var

character: name of second random effect we want to vary

R2level

integer: number of levels for R2var. Right now, the second random effect can only be changed to a fixed value and not be varied like simvar

nCores

number of cores to use in simulation process.

sampe_sizes

vector of integers: sample sizes you want to test power of

Value

A modified mixed model


DejanDraschkow/mixedpower documentation built on Feb. 16, 2024, 7:58 a.m.