EstimatePower {RSmallTelescopes}R Documentation

Estimate Power

Description

Estimate statistical power of an effect size parameter by simulation using original sample size.

Usage

EstimatePower(data, n.original, B.power, analysis, n.rows, alpha)

Arguments

data

Dataset (matrix).

n.original

The sample size of the original analysis (scalar).

B.power

The number of samples to be simulated (scalar).

analysis

Function to produce a p value and an effect size estimate.

n.rows

The number of rows per subject in the dataset (scalar)

alpha

Set alpha level for analysis (scalar)

Value

Power estimate generated through simulation (scalar).

Examples

# create or import dataset
 example.data <- matrix(rnorm(50), 25, 2)  

# estimate statistical power
 EstimatePower(
   data = example.data, 
   n.original = 10, 
   analysis = function(data) {
     corr <- cor.test(data[,1], data[,2])
     return(list(effect.size = corr$estimate, p.value = corr$p.value))
   }, 
   B.power = 100,
   n.rows = 1, 
   alpha = 0.05)

[Package RSmallTelescopes version 1.0.4 Index]