Learn R Programming

MSPRT (version 2.1)

find.threshold.oneProp: Optimizing the UMPBT objective function in fixed design one-sample proportion tests

Description

Given \(\delta\), this function finds the difference (optimum value of the objective function - a constant) in one-sample proportion tests in a fixed design. Notation is as in the supplemental information.

Usage

find.threshold.oneProp(delta, side = "right", n, p0 = 0.5, opt.interval, root)

Arguments

delta

a positive numeric; corresponding to this, the UMPBT alternative (UMPBT(\(\delta\))) is obtained.

side

a character; direction of the alternative hypothesis H1.

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

Default: "right".

n

a positive numeric (integer); number of samples on which the fixed design one-sample test is based on.

p0

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

Default: 0.5.

opt.interval

a numeric vector of length 2; contains the lower and upper endpoints of an interval to be optimized over.

Endpoints should lie inside (0,1).

Default: c(p0,1) if side = "right", and c(0,p0) if side = "left".

root

a numeric; the `constant' in the above description.

Given this, the function retunrs (optimum value of the objective function - root).

Value

If root=k, this returns a numeric denoting the difference (optimum value of the objective function - k).

Details

Apart from finding the optimum value of the objective function, the argument root can be used to solve for a delta. For example, using root=k we can find a delta such that the optimized value of the objective function is k.

Examples

Run this code
# NOT RUN {
## returns minimum value of the objective function
find.threshold.oneProp(delta= 25, n= 60, p0= 0.2, root= 0)

## returns (minimum value of the objective function -5)
find.threshold.oneProp(delta= 25, n= 60, p0= 0.2, root= 5)
# }

Run the code above in your browser using DataLab