R2power: Function running simulation for two varying random effect

View source: R/meta_functions.R

R2powerR Documentation

Function running simulation for two varying random effect

Description

mixedpower() combines a databased and SESOI (smallest effect of interest) simulation for a combination of two specified randomeffects

Usage

R2power(
  model,
  data,
  fixed_effects,
  simvar,
  steps,
  R2var,
  R2level,
  critical_value,
  n_sim = 1000,
  SESOI = F,
  databased = T,
  maxCores = NULL
)

Arguments

model

lme4 model: mixed model of interest

data

data frame: data used to fit the mixed model of interest

fixed_effects

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

simvar

character element: name of the variable that contains the random effect we want to simulate along (e.g. subject number or stimuli number) in data

steps

vector of integers: steps for "simvar" you want to test power of

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

critical_value

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

n_sim

integer: number of simulations to run

SESOI

vector with floatsĀ“indicating the desired SESOIs. If FALSE, no SESOI simulation is run.

databased

logical value: indicates whether databased power simulation #' @param maxCores allows to specify the maximum number of cores to be used in simulation process. If unspecified, R2power will run simulations on all but one cores.

Value

A modified mixed model


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