Skip to contents

Returns the two-tailed z-score corresponding to a confidence level. Centralises the qnorm(1 - (1 - confidence_level) / 2) idiom that would otherwise be repeated throughout the codebase.

Usage

z_score(confidence_level = 0.95)

Arguments

confidence_level

Numeric in (0, 1), default 0.95

Value

Positive z-score (e.g. 1.96 for 0.95)

Examples

if (FALSE) { # \dontrun{
z_score(0.95)   # 1.959964
z_score(0.99)   # 2.575829
} # }