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

Description Usage Arguments Value Examples

View source: R/helpers.R

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

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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 April 19, 2018, 7:21 p.m.