pwr_z_test_1pop: Power and sample size for z test for one population

Description Usage Arguments Details Value Examples

View source: R/pwr_z_test_1pop.R

Description

pwr_z_test_1pop computes the power and the sample size for testing mean in a normal variable with known variance.

Usage

1
2
pwr_z_test_1pop(m, m0, sigma, n = NULL, pwr = NULL,
alternative = "two.sided", sig_level = 0.05)

Arguments

m

populational mean

m0

mean under null hypothesis

sigma

populational standard deviation

n

number of observations (sample size)

pwr

power of test 1 + β (1 minus type II error probability)

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less"

sig_level

significance level (Type I error probability)

Details

Exactly one of the parameters 'n' and 'pwr' must be passed as NULL, and that parameter is determined from the other. Notice that the last one has non-NULL default so NULL must be explicitly passed if you want to compute it.

This function computes internally the effect size, given the population mean, mean under null hypothesis and the population standard deviation. These three parameters are required.

Value

pwr_z_test_1pop returns a list with the following components:

m

populational mean

m0

mean under null hypothesis

sigma

populational standard deviation

sig_level

significance level

power_sampleSize

A tibble with sample size n and power pwr

Examples

1
2
3
4
5
6
# Power
pwr_z_test_1pop(m = 20, m0 = 10, sigma = 10, n = 25, pwr = NULL,
alternative = "two.sided", sig_level = 0.05)
# Sample size
pwr_z_test_1pop(m = 20, m0 = 10, sigma = 10, n = NULL, pwr = 0.95,
alternative = "two.sided", sig_level = 0.05)

gilberto-sassi/power documentation built on July 17, 2020, 1:02 p.m.