Package 'RSmallTelescopes'

Title: Empirical Small Telescopes Analysis
Description: We provide functions to perform an empirical small telescopes analysis. This package contains 2 functions, SmallTelescopes() and EstimatePower(). Users only need to call SmallTelescopes() to conduct the analysis. For more information on small telescopes analysis see Uri Simonsohn (2015) <doi:10.1177/0956797614567341>.
Authors: John Ruscio [aut, cre], Samantha Costigan [ctb]
Maintainer: John Ruscio <[email protected]>
License: MIT + file LICENSE
Version: 1.0.4
Built: 2025-02-28 08:09:34 UTC
Source: CRAN

Help Index


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)

Small Telescopes

Description

Estimate statistical power for point estimate of effect size plus the lower and upper bounds of a confidence interval.

Usage

SmallTelescopes(
  data,
  analysis,
  n.original,
  B.CI = 10000,
  CI.level = 0.9,
  B.power = 10000,
  alpha = 0.05,
  n.rows = 1,
  seed = 1
)

Arguments

data

Dataset (matrix).

analysis

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

n.original

The sample size of the original analysis (scalar).

B.CI

The number of simulated samples used to construct CI (scalar); default = 10,000.

CI.level

The confidence level of the interval (scalar); default = .90.

B.power

The number of samples to be simulated (scalar); default = 10,000.

alpha

Set alpha level for analysis (scalar); default = 0.05.

n.rows

The number of rows per subject in the dataset (scalar); default = 1.

seed

Allows randomly generated numbers to be reproducible (scalar); default = 1.

Value

Displays statistical power for point estimate of an effect size plus the lower and upper bounds of a confidence interval. List contains the following components:

n.replication

The sample size of the replication analysis.

n.original

The sample size of the original analysis.

B.CI

The number of simulated samples used to construct CI.

CI.level

The confidence level of the interval.

B.power

The number of samples simulated.

p.value

The p value calculated from the replication data

es.estimate

Point estimate of effect size.

es.power

Estimated power for the point estimate of effect size.

CI.lower.estimate

Effect size estimate at the lower bound of the CI.

CI.lower.power

Estimated power for the lower bound of the CI.

CI.upper.estimate

Effect size estimate at the upper bound of the CI.

CI.upper.power

Estimated power for the upper bound of the CI.

Examples

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

# conduct empirical small telescopes analysis
 SmallTelescopes(
   data = example.data, 
   analysis = function(data) {
     corr <- cor.test(data[,1], data[,2])
     return(list(effect.size = corr$estimate, p.value = corr$p.value))
   }, 
   n.original = 10, 
   B.CI = 100, 
   B.power = 100)