many.outcome.sim: Simulate a multiple-testing scenario

Description Usage Arguments Value Examples

Description

Simulates type I error inflation from multiple testing for a test comparing two group means. The groups are compared on n.dv outcome measurements, each mutually correlated at a user-specified level. A matrix of p values is returned with n.dv columns and nsim rows.

Usage

1
many.outcome.sim(n, nsim, n.dv = 3, correl = 0.5)

Arguments

n

The number of people measured in each group per simulation.

nsim

The number of simulated samples to run.

n.dv

The number of outcome measurements (i.e. dependent variables or DVs) taken per person.

correl

The correlation of the (normally distributed) outcome measurements—all pairs of measurements have the same correlation.

Value

A matrix of p values with n.dv columns and nsim rows. Each row corresponds to a different sample, and the p values from the respective outcome measures are in distinct columns.

Examples

1
2
3
sims <- many.outcome.sim(100, nsim = 1000, n.dv = 5, correl = .4)
mean(apply(sims, 1, min) < .05) #familywise error rate with no correction
mean(apply(sims, 1, min) < .05/5) #familywise error rate with Bonferonni correction for 5 comparisons

mdedge/stfspack documentation built on May 9, 2019, 8:17 a.m.