An R script for construction and performance evaluation of sequential multi-hypothesis tests for the Bernoulli model
This repository contains an R module for design and performance evaluation of sequential multi-hypothesis tests.
Currently, only the model of binary responses (sampling from a Bernoulli population) is covered.
The detailed description of the method and algorithms can be found in
- The file multihypothesis.R contains all the functions providing the user interface for all the tasks.
The list of functions can be seen below.
The function for designing an optimal truncated sequential multi-hypothesis test.
Arguments:
- H horizon (maximum number of steps to employ)
- lam matrix of Lagrange multipliers
- th vector of the hypothesized values of the parameter (success probability)
- gam the vector of weights used to calculate the weighted expected sample size (ESS)
- thgam parameter values at which ESSs are calculated to used in the weighted ESS
Returns: the designed test which minimizes the weighted ESS
The function for designing a truncated MSPRT (see description in the cited article).
Arguments:
- H horizon (maximum number of steps to employ)
- lA matrix of the logarithmic thresholds
- th vector of the hypothesized values of parameter (success probability)
Returns: the designed truncated MSPRT
The function for designing the simplified (Dropped Backward Control-)version of the optimal truncated sequential multi-hypothesis test. (To be published soon)
Arguments:
- H horizon (maximum number of steps to employ)
- lam matrix of Lagrange multipliers
- th the vector of the hypothesized values of parameter (success probability)
- gam the vector of weights used to calculate the weighted expected sample size (ESS)
- thgam parameter values at which ESSs are calculated to be used in the weighted ESS
Returns: the designed test which approximately minimizes the weighted ESS
The function calculating the probability to accept a hypothesis given a value of the parameter.
Arguments:
- test test designed by any of the functions OptTest, DBCTest, MSPRT
- th parameter value at which the probability to accept the hypothesis is calculated
- i number of the hypothesis whose acceptance probability is evaluated
Returns: the probability to accept
The function calculating the expected sample size of a test, given a value of the parameter.
Arguments:
- test test designed by any of the functions OptTest, DBCTest, MSPRT
- th parameter value at which the ESS is calculated
Returns: ESS
The function calculating the probability that the test stops after a given stage number.
Arguments:
- test test designed by any of the functions OptTest, DBCTest, MSPRT
- th parameter value at which the probability is calculated
- k the stage number
Returns: the probability
The function for carrying out Monte Carlo simulations
Arguments:
- test test designed by any of the functions OptTest, DBCTest, MSPRT
- hyp parameter value for the simulation
- K number of hypotheses
- nMC number of replications for the simulation
Returns: rates of acceptations and their standard errors, ESS and its standard error
The function to determine the maximum number of stages the test uses
Arguments:
- test test designed by any of the functions OptTest, DBCTest, MSPRT
Returns: maximum number of stages
- The file usage.R is a usage example of these functions