power.sim.1sz: Estimate the power of a one-sample z test by simulation

Description Usage Arguments Value Examples

Description

Simulates nsims normal samples with expectations differing from a value specified by the null hypothesis by d (known) standard deviations. For each sample, the null hypothesis is tested by a one-sample z test, and the p value is compared with the specified significance level.

Usage

1
power.sim.1sz(n, nsim, d, lev = 0.05)

Arguments

n

The size of each simulated sample.

nsim

The number of simulated samples to run.

d

An effect size: the number of (known) standard deviations by which the expectation of the sampled data differs from a hypothesized expectation.

lev

The significance level of the one-sample z-test.

Value

The proportion of p values less than the specified level (i.e. the estimated power).

Examples

1
powersim.1sz(n = 20, nsim = 10000, d = .5)

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