ps.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
ps.1sz(d, n, level = 0.05, nsim = 10000)

Arguments

d

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

n

The size of each simulated sample.

level

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

nsim

The number of simulated samples to run.

Value

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

Examples

1
ps.1sz(d = 0.5, n = 20)

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