pwr_freq: Frequentist Power Computation

View source: R/frequentist.R

pwr_freqR Documentation

Frequentist Power Computation

Description

Constructs a simple hypothesis testing framework based on the parameters specified and returns the corresponding frequentist power.

Usage

pwr_freq(n, theta_0, theta_1, sigsq, alt, alpha)

Arguments

n

sample size (either scalar or vector)

theta_0

initial value the parameter is set equal to in the null hypothesis, where H0: θ = θ 0.

theta_1

alternative value to be compared to theta_0. See alt for specification options.

sigsq

known variance σ^2

alt

specifies comparison between θ_1 and θ_0, where alt = "greater" tests if θ_1 > θ_0, alt = "less" tests if θ_1 < θ_0, and alt = "two.sided" performs a two-sided test. alt = "greater" by default.

alpha

significance level

Value

objects corresponding to the power

  • pwr_table: table of sample sizes and corresponding power values.

  • pwr_plot: power curve that is only returned if n is a vector. This power curve covers a wider range of sample sizes than the inputted values specified for n, where specific power values are marked in red.

  • power_val: single power value that is returned if n is a scalar.

Examples

n <- seq(10, 140, 5)
theta_0 <- 0.15
theta_1 <- 0.35
sigsq <- 0.3

pwr_vals <- pwr_freq(n = n, theta_0 = theta_0, theta_1 = theta_1, 
sigsq = sigsq, alt = "greater", alpha = 0.05)
pwr_vals$pwr_plot

jpan928/bayesassurance_rpackage documentation built on June 25, 2022, 5:24 a.m.