Learn R Programming

MSPRT (version 2.1)

type2.error.oneProp: Type 2 error function of one-sample proportion tests in a fixed design

Description

For one-sample proportion tests in a fixed design, this function evaluates (Type 2 error - a constant) at a specified alternative value of proportion.

Usage

type2.error.oneProp(alt, side = "right", null = 0.5, n, type1 = 0.005, root = 0)

Arguments

alt

a numeric in (0,1); the value of proportion (consistent with side) where the Type 2 error of the fixed design test needs to be evaluated at.

side

a character; direction of the alternative hypothesis H1.

Has to be one of "right" or "left".

Default: "right".

null

a numeric in (0,1); the hypothesized value of proportion under a simple null hypothesis.

Default: 0.5.

n

a positive numeric (integer); sample size to be used.

type1

a numeric in (0,1); prespecified Type 1 error probability.

Default: 0.005.

root

a numeric; when this is 0, the Type 2 error is returned. In general, (Type 2 error - root) is returned.

Default: 0.

Value

If root=k, a numeric (Type 2 error - k) evaluated at the speified alternative value alt is returned.

Details

In case of one-sample proportion tests in a fixed design, this function evaluates the Type 2 error at a specified value alt. We can also use this function to do the other way round by exploiting the argument root; that is, given a Type 2 error \(\beta\), we can obtain the alt where Type 2 error equals \(\beta\). To do that, we need to substitute root=\(\beta\) in the argument of this function, and then solve it for alt. The function find.alt() in this package excatly does this.

Examples

Run this code
# NOT RUN {
## Type 2 error at an alternative value
type2.error.oneProp(alt= 0.5, null= 0.2, n= 60)

## (Type 2 error - 0.5) at the same alternative value
type2.error.oneProp(alt= 0.5, null= 0.2, n= 60, root = 0.5)
# }

Run the code above in your browser using DataLab