wc.1sz: Simulate the winner's curse with a one-sample z-test

Description Usage Arguments Value Examples

Description

Simulates the "winner's curse"—the effect that especially in low-power situations, estimates that result in signficant tests for the null hypothesis of theta = 0 tend also to be overestimates. In each simulation, a single normal sample is drawn and the hypothesis that the true effect size is zero is tested(by one-sample t-test). The output is a named vector with a a true effect size (measured in number of standard deviations from the value under the null hypothesis), the "estimated" effect size, which is the mean effect size from simulations that produced significant results, and the power, which is the proportion of simulations that achieved significance. A histogram is also produced, with all the estimated effect sizes shown, and the estimates associated with significant tests colored grey.

Usage

1
wc.1sz(d, n, lev = 0.05, nsim = 10000, abs.vals = FALSE, br = 50)

Arguments

d

The true effect size in the simulations.

n

The size of each simulated sample.

lev

The significance level of the one-sample z-test. Effect size estimates are averaged in the "estimated d" part of the output only if the one-sample z test produces a p value less than the level.

nsim

The number of simulated samples to run.

abs.vals

controls whether we pay attention to the sign of the estimate (if FALSE, the default, we do).

br

the breaks parameter for the histogram.

Value

a named vector with a a true effect size (measured in number of standard deviations from the value under the null hypothesis), the "estimated" effect size, which is the mean effect size from simulations that produced significant results, and the power, which is the proportion of simulations that achieved significance. A histogram is also produced, with all the estimated effect sizes shown, and the estimates associated with significant tests colored grey.

Examples

1
wc.1sz(d = 0.5, n = 20, nsim = 1000)

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