get_monte_carlo_se: Calculate the Monte Carlo standard error of the empirical...

View source: R/helpers.R

get_monte_carlo_seR Documentation

Calculate the Monte Carlo standard error of the empirical power estimates

Description

Returns the expected simulation error for a study design. Indicates how many simulation that are needed for a desired precision in the empirical power estimates.

Usage

get_monte_carlo_se(object, nsim, power, ...)

## S3 method for class 'plcp_power_3lvl'
get_monte_carlo_se(object, nsim, ...)

## S3 method for class 'plcp_power_2lvl'
get_monte_carlo_se(object, nsim, ...)

Arguments

object

An object created by get_power

nsim

A numeric indicating the number of simulations

power

Optional. A numeric indicating the empirical power.

...

Currently not used. Used when object is NULL.

Value

A data.frame with the estimated power, expected standard error of the simulated power estimate, and the 95 % CI of the estimate.

Examples

paras <- study_parameters(n1 = 11,
                          n2 = 10,
                          n3 = 6,
                          T_end = 10,
                          icc_pre_subject = 0.5,
                          icc_pre_cluster = 0,
                          var_ratio = 0.03,
                          icc_slope = 0.05,
                          cohend = -0.8)

x <- get_power(paras)
get_monte_carlo_se(x, nsim = 1000)

# Without an object
get_monte_carlo_se(power = 0.8, nsim = 1000)

rpsychologist/powerlmm documentation built on May 11, 2023, 12:24 a.m.