Skip to contents

The caTesting() function is a function that simulates the microbiological testing of food unit samples taken from a lot. Lots are subjected, at a given probability (pLotTested), to sampling and testing, according to a sampling plan defined by the user. The algorithm allows for two-class or three-class sampling plans, although the most commonly used for L. monocytogenes is the former one: n (sample size), c (maximum level accepted), w (weight used in the enrichment essay). By performing a bootstrapping on the sampling and testing scheme, the algorithm estimates that probability of detecting contaminated lots. Contaminated lots detected after testing are not removed from the matrix. If the input matrix is in the sublot arrangement, the size of the sublot (sizeSublot) must be provided, so that the testing is carried out at the lot level (and not at the sublot level!). Furthermore, the user has the option to have the output matrix N returned in the original lot arrangement by setting backToSublot = FALSE. If no value is assigned to this argument, the output matrix N is returned in the sublot arrangement.

Usage

caTesting(
  data = list(),
  nTested,
  gTested,
  MTested,
  cTested,
  pLotTested,
  Se,
  unitSize = NULL,
  gTestedEnum = 10,
  sizeLot = NULL,
  sizeSublot = NULL,
  backToSublot = TRUE,
  iterSub = NULL
)

Arguments

data

a list of:

N

(CFU) A matrix of size number of lots/sublots by number of packs, representing the numbers of L. monocytogenes per pack unit;

P

Mean prevalence of contaminated lots (scalar).

nTested

Sample size or number of units tested (scalar).

gTested

(g) Sample weight tested per unit (scalar or vector).

MTested

(CFU/g) Maximum concentration accepted in a sample (scalar or vector). If \(>0\), will lead to a 3-class plan.

cTested

Maximum number of samples accepted between \(m = 0\) and M (scalar or vector).

pLotTested

Proportion of lots subjected to sampling and testing or frequency of testing (scalar or vector).

Se

Sensibility of the test or probability to detect each bacterial cell applying a given microbiological essay (scalar or vector).

unitSize

(g) Weight of the contents of a pack unit (scalar or vector).

gTestedEnum

(g) Sample weight tested for enumeration (scalar or vector).

sizeLot

Total number of cantaloupes making up a lot, i.e., cantaloupes harvested in a field batch.

sizeSublot

Number of cantaloupes processed in a sublot. sizeSublot must be a multiple of sizeLot. NOTE: keep as NULL if the input matrix is in lot arrangement.

backToSublot

Set to FALSE if the output matrix N is to be returned in the lot arrangement. By default, if sizeSublot is provided, the output matrix N is returned in the sublot arrangement.

iterSub

Number of internal repetition for the testing. If NULL, it will be set to the minimum of nLots and 1000.

Value

A list of three elements of data objects:

N

(CFU) A matrix of size number of lots/sublots by number of packs, representing the numbers of L. monocytogenes per pack unit;

P

Prevalence of contaminated lots after within-lot testing (scalar),

D

Probability of detecting contaminated lots (scalar).

Author

Regis Pouillot rpouillot.work@gmail.com

Examples

# columns <- 175
# rows <- 200
# N0 <- list(N=matrix(rpois(columns*rows, 3),
#            nrow = rows, ncol = columns), P=0.16)

# Test directly (No notion of sublot)
# Nf <- caTesting (N0, nTested = 5, gTested = 25, MTested = 0,
#                 cTested = 0, pLotTested = .1, sizeLot=100,
#                 Se=1, unitSize=200)
# dim(Nf$N)

# backToSublot = TRUE (default):
# Input matrix in sublots -> lot -> testing -> Output matrix in sublots
# Nf <- caTesting (N0, nTested = 5, gTested = 25, MTested = 0,
#                  cTested = 0, pLotTested = .1,
#                  Se=1, unitSize=200,
#                  sizeLot = 100, sizeSublot=20)
# dim(Nf$N)

# backToSublot = FALSE: Input matrix in sublots -> lot -> testing -> Input matrix in lots
# Nf <- caTesting (N0,
#                  nTested = 5,
#                 gTested = 25,
#                 MTested = 0,
#                 cTested = 0,
#                 pLotTested = .1,
#                 Se=1,
#                 unitSize=200,
#                 sizeLot = 100,
#                 sizeSublot=20,
#                 backToSublot = FALSE)
# dim(Nf$N)