Learn R Programming

MSPRT (version 2.1)

type2.error.twoZ: Type 2 error function of two-sample Z-tests in a fixed design

Description

For a two-sample Z-test in a fixed design, this function evaluates (Type 2 error - a constant) at a specified alternative value of the hypothesized parameter (the difference between the population means of Group-2 and Group-1). The hypothesized value under the simple null hypothesis is set at 0.

Usage

type2.error.twoZ(alt, side = "right", sigma0 = 1, n1, n2, type1 = 0.005, root = 0)

Arguments

alt

a numeric; the value of hypothesized parameter (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".

sigma0

a positive numeric; the known common population standard deviation.

Default: 1.

n1

a positive numeric (integer); sample size from Group-1 to be used.

n2

a positive numeric (integer); sample size from Group-2 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 two-sample Z-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.twoZ(alt= 1.2, n1= 60, n2= 60)

## (Type 2 error - 0.5) at the same alternative value
type2.error.twoZ(alt= 1.2, n1= 60, n2= 60, root = 0.5)
# }

Run the code above in your browser using DataLab