Learn R Programming

bayesassurance (version 0.1.0)

pwr_freq: 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: \theta = \theta 0\).

theta_1

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

sigsq

known variance \(\sigma^2\)

alt

specifies comparison between \(\theta_1\) and \(\theta_0\), where alt = "greater" tests if \(\theta_1 > \theta_0\), alt = "less" tests if \(\theta_1 < \theta_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

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab