mcmaster-epgProtocol

Statistical analysis of McMaster faecal egg counts with mcmaster-epg: exact confidence limits, correction for egg loss, detection limits and herd-level estimation

  • Maciej Kochanowski1 corresponding author
  • Joanna Dąbrowska2
  1. Department of Bacteriology and Bacterial Animal Diseases, National Veterinary Research Institute, 57 Partyzantów Avenue, 24-100 Puławy, Poland
  2. Department of Virology and Viral Diseases of Animals, National Veterinary Research Institute, 57 Partyzantów Avenue, 24-100 Puławy, Poland

Abstract

This protocol is the computational and statistical companion of the laboratory protocol P1 (Kochanowski M, Dąbrowska J. Quantitative faecal egg count by the McMaster technique (Raynaud's modification). protocols.io. DOI: [to be inserted on publication]). P1 describes the McMaster technique in Raynaud's modification at the bench and yields raw egg counts; this protocol turns those counts into eggs per gram of faeces (EPG) with a stated uncertainty, using the open-source package mcmaster-epg. A method profile records the multiplication factor, the recovery of eggs and the dispersion of counts between preparations. From it the package gives exact confidence limits, EPG corrected for egg loss, the EPG detected in 50% and 95% of examinations (LOD50, LOD95), pooled replicate readings and replicate planning, an exact interval for a sequential reading of grids, whole chamber and flotation slide, herd-level estimates from one count per animal, survey size, calibration from spiked samples and the analysis of many samples at once. It runs as a command-line tool, a Python library and a browser application without installation, and exports its results for reporting. The built-in profiles were fitted to the spiked dog and pig faeces of Kochanowski et al. (2013), and the procedures were checked against that study and by simulation; the profiles come from one laboratory and one chamber type.

1Guidelines

GL1Scope and audience

This protocol (P2) is the computational and statistical companion of the laboratory protocol P1 [1]. P1 describes the McMaster technique in Raynaud's modification at the bench, from the flotation solution to the record of raw counts, and calculates the nominal EPG; P2 starts from those raw counts. It is intended for veterinary parasitology laboratories, researchers and teachers who need each McMaster result with a stated uncertainty, corrected for egg loss and set against its limit of detection.

P2 describes (i) the inputs it takes from the bench; (ii) the choice or construction of a method profile; (iii) the analysis of single samples, replicate readings, detection limits, a sequential reading protocol and herds with mcmaster-epg [2]; and (iv) the reporting of results. It does not repeat the bench procedure, the identification of eggs or the nominal EPG arithmetic of P1, and it does not cover faecal egg count reduction tests or hierarchical models; for these the package supplies the raw count and the correction factor that dedicated tools expect (step G1).

GL2Principle

From count to EPG. A McMaster examination counts the eggs that float in a defined part of a counting chamber filled with a suspension of faeces in a flotation solution of known dilution. The multiplication factor converts the count into EPG. With a mass m of faeces suspended in a volume V of flotation solution and a volume v read, the geometric factor is f = (m + V) / (m × v); the package assumes, as the nominal factors do, that one gram of faeces adds one millilitre to the suspension. The McMaster method of Gordon and Whitlock [3] in Raynaud's modification [4], as used in P1 and in the reference study [5], suspends 2 g of faeces in 28 ml of saturated magnesium sulphate solution (MgSO4) (30 ml, that is 15 ml per gram of faeces) and uses the nominal factors 100, 50, 15, 7 for one grid, two grids, the whole chamber and the flotation slide, respectively. These are the only bench values that the calculations use.

Why the count is not the EPG. Three sources of error separate the two. Counting error: eggs are discrete, so even a perfectly mixed suspension gives counts that scatter around their mean (Poisson variation). Egg loss: not every egg of the sample reaches the counted volume and is seen; in spiked samples the share recovered depended on the egg type and on the part of the preparation read [5]. Between-sample variation: independently prepared portions of one sample differ more than counting error explains. The nominal product count × factor ignores the last two and carries no statement of uncertainty.

What the software adds. mcmaster-epg describes a procedure by a method profile (factor, recovery, dispersion and their uncertainty) and treats a count as negative binomial with mean recovery × EPG / factor. From this single count model it derives exact confidence limits, the EPG corrected for egg loss, limits of detection, the number of replicates for a target precision, the interval of a sequential reading record, herd-level quantities and survey size. Figure 1 shows how the bench work of P1 and the computational steps of this protocol connect.

Workflow from sample to report Flow diagram in three lanes, bench (P1), software and report, connecting the raw counts of the laboratory protocol with the steps of this protocol up to citation. From the bench (P1) steps A1 to A4 Bench work: see P1 suspension, two-cell chamber, reading and record of the raw counts Take the inputs A1 A2 counting variant or stage, raw count per egg type, readings, host and egg type Replicates A3 independent preparations, not re-readings Check the method profile A4 variant, dilution and factor of the procedure In mcmaster-epg steps B1 to F5 Choose the method profile B4 built-in, 2013 procedure B1 entered from a publication B2 calibrated from spiked samples B3 Run the task epg, batch C1 to C5 lod, plan D1, D2 sequential reading E1 to E5 herd, survey F1 to F5 Result EPG with exact confidence limits, corrected EPG, LOD50 and LOD95, herd fractions, survey size Report steps G1 to G3 Export the result G1 JSON, TXT or CSV; printable report Keep a reproducibility record G2 package version, profile file, command line, seed Cite G3 P1, software, method paper and this protocol stage and count result and profile Workflow from sample to report Flow diagram in three lanes, bench (P1), software and report, connecting the raw counts of the laboratory protocol with the steps of this protocol up to citation. From the bench (P1) steps A1 to A4 Bench work: see P1 suspension, two-cell chamber, reading and record of the raw counts Take the inputs A1 A2 counting variant or stage, raw count per egg type, readings, host and egg type Replicates A3 independent preparations, not re-readings Check the method profile A4 variant, dilution and factor of the procedure In mcmaster-epg steps B1 to F5 Choose the method profile B4 built-in, 2013 procedure B1 entered from a publication B2 calibrated from spiked samples B3 Run the task epg, batch C1 to C5 lod, plan D1, D2 sequential reading E1 to E5 herd, survey F1 to F5 Result EPG with exact confidence limits, corrected EPG, LOD50 and LOD95, herd fractions, survey size Report steps G1 to G3 Export the result G1 JSON, TXT or CSV; printable report Keep a reproducibility record G2 package version, profile file, command line, seed Cite G3 P1, software, method paper and this protocol
Figure 1. Workflow from sample to report. The bench work of P1 yields the raw count and, in the sequential protocol, the stage; Section A takes them as inputs. Software steps choose a method profile (built in, entered or calibrated; Section B) and a task (Sections C to F). Report steps export and cite the result (Section G). Labels refer to the steps of this protocol. SVG file

GL3Definitions

Terms are used in the following sense throughout this protocol, the package and its output; terms of the bench procedure follow P1.

Eggs per gram (EPG)

Number of eggs of a parasite per gram of faeces of the sample: the quantity this protocol estimates. Nominal EPG is count × nominal factor; corrected EPG accounts for egg loss.

Suspension

Faeces mixed with flotation solution. Its volume per gram of faeces enters every factor (GL2).

Two-cell McMaster chamber

The counting chamber of P1 and of the reference study (FiBL McMaster chamber): two cells (each cell is half of the chamber in the 2013 paper's description), each carrying one engraved grid of 10 mm × 10 mm; the whole chamber holds 1.5 ml [5]. The counting areas are shown in Fig. 2 of P1. Chambers of other makes differ in size and volume; the built-in profiles describe this chamber only.

Counting variant

The part of the preparation that is read: one grid (the engraved grid of one cell), two grids (one in each cell), whole chamber (whole area of both cells) or flotation slide (package values one_grid, two_grids, whole_chamber, flotation_slide; see Table 1 in GL4 and Fig. 2).

Flotation slide

The cover slip of a flotation tube filled with the suspension, read as in P1: a separate preparation of the suspension, not a part of the chamber.

Volume read

The volume of suspension whose eggs are counted. The nominal factors imply 0.15 ml for one grid, 0.30 ml for two grids and 1.0 ml for the whole chamber.

Multiplication factor (f)

The EPG represented by one egg counted. Nominal factor: Raynaud's factor of the counting variant (GL2, Table 1). Geometric factor: (faeces mass + flotation volume) / (faeces mass × volume read). Empirical whole-chamber factor: 1/slope of the regression of eggs counted on eggs added in spiked samples, 46 (T. canis), 28 (Trichuris spp.), 21 (A. suum) [5].

Count, reading, replicate

A count is the number of eggs of one egg type seen in one reading of the chosen part of the preparation. A replicate is a reading of an independently prepared portion of the same sample (new portion, new suspension, new filling), not a second reading of the same filling.

Recovery (r) and egg loss

Recovery is the expected share of the eggs of the sample that are counted, relative to the nominal factor: the mean count is r × EPG / f. Egg loss is 1 − r. Being relative to the nominal factor, r can exceed 1.

Corrected EPG

The count multiplied by a factor corrected for egg loss. For the whole chamber of a built-in combination the package uses the published empirical factor; otherwise the nominal factor divided by the recovery of the count model. The output field correction_source names which.

Dispersion (k)

Variation between independently prepared samples beyond counting error, in the negative binomial count model with variance = mean + mean2/k. k = ∞ (inf) means Poisson counts; a small k means large variation between preparations.

Method profile

The description of one procedure that every calculation uses: factor, recovery, k, their uncertainty ranges and, where available, the spiked-sample data. A profile is built in (Kochanowski et al. 2013), entered by hand from a publication or calibrated from one's own spiked samples, and can be saved as a JSON file.

Nominal method

The analysis without a profile: no egg loss (r = 1) and Poisson counts. It overestimates detection.

Positive sample

A reading with at least one egg counted. The package assumes that there are no false positives.

LOD50 and LOD95

The EPG detected (count ≥ 1) in 50% and in 95% of single examinations; π denotes this probability of detection, not to be confused with the grid share p. How LODπ is obtained depends on the kind of profile. Built-in profiles: from a detection curve with shape s fitted to the published share of positive spiked samples, LODπ = LOD50 × (−ln(1 − π) / ln 2)1/s. Entered profiles: from the count model, LODπ = f × mπ(k) / r, where mπ(k) = k[(1 − π)−1/k − 1] is the mean count at which P(count ≥ 1) = π. Calibrated profiles: the same count model fitted to the raw counts of the spiked samples (GL6). The published LOD of the reference study is a different quantity: the lowest spiking level at which eggs were found in at least half of the replicates of that level.

Quantitative range

The range of spiking levels on which a published whole-chamber regression was fitted; the output field within_quantitative_range states whether a corrected EPG lies inside it.

Apparent prevalence

The share of examined animals with a positive count, with an exact binomial confidence interval.

Fraction at or above a threshold

The share of animals whose true EPG is at or above an EPG threshold t, for example a treatment threshold. It is estimated by limits without distributional assumptions and under the gamma aggregation model.

Aggregation model

The usual model of uneven parasite burdens: a fraction of the animals is infected and their EPG follows a gamma distribution, so counts between animals are negative binomial. Its shape parameter measures aggregation.

Sequential reading protocol

Reading in up to three stages, two grids, the whole chamber of the same filling and a flotation slide, stopping at the first stage with eggs. The record is the stage and the count.

Share p

In the sequential protocol, the share of the eggs of one chamber filling that lie on the two grids (not the probability of detection π).

Confidence level; exact interval

The confidence level (conf; 0.95 unless changed) is the intended coverage of an interval. An interval is exact when, under the count model with known parameters, its coverage is at least conf for every true EPG; it is obtained by inverting the count distribution, not by a normal approximation. For the sequential protocol the guarantee holds over all records together, not for each stage separately.

GL4Counting variants as sampling fractions

Each counting variant reads a fraction of the suspension and so has its own factor, recovery and dispersion (Fig. 2). The table gives the volume that each nominal factor implies; the counting areas themselves are shown in Fig. 2 of P1. Limits of detection and sensitivity by variant, from the spiked samples of the reference study, are given in Table 1 of P1 and in Table 4 of Kochanowski et al. (2013) and Table 5 of Kochanowski et al. (2013) [5]; the limits fitted by the package are in Table 2 (GL5) and step D1.

Counting variants as a statistical model Diagram of the four counting variants as sampling fractions, with volume read, nominal factor, recovery and dispersion, and of the path from a count to the nominal and corrected EPG, their intervals and the limits of detection. A Counting variants as sampling fractions two-cell chamber: counting areas in P1, Fig. 2 One grid the engraved grid of one cell Volume read 0.15 ml Nominal factor f 100 Recovery r 0.436 95% range 0.344 to 0.533 Dispersion k 12.8 95% range 1.82 to ∞ Two grids one grid in each cell Volume read 0.30 ml Nominal factor f 50 Recovery r 0.423 95% range 0.354 to 0.494 Dispersion k 7.85 95% range 2.34 to ∞ Whole chamber whole area of both cells Volume read 1.0 ml Nominal factor f 15 Recovery r 0.396 95% range 0.347 to 0.443 Dispersion k 4.36 95% range 2.62 to 10.1 Flotation slide a separate preparation: the cover slip of the tube Volume read not defined by a volume Nominal factor f 7 Recovery r 0.161 95% range 0.135 to 0.187 Dispersion k 1.72 95% range 1.14 to 2.97 p: share of the chamber's eggs on the two grids p = (fwhole / fgrids) × (rgrids / rwhole) = 0.3203 (E24) r and k: built-in profiles of Toxocara canis in dog faeces (E10a to E10d); egg loss = 1 − r; volume read on the scale of the chamber (1.5 ml) B From count to estimate and interval Count N eggs counted in the area read; replicate readings are pooled E04: N = 6, whole chamber, T. canis, dog Nominal EPG = N × f Interval: exact Poisson; counting error only, no egg loss. 90 (33.0 to 195.9); f = 15 Corrected EPG = N × fc fc = f / r, except for the whole chamber of a built-in profile, where fc is the published factor: 46 (T. canis), 28 (Trichuris spp.), 21 (A. suum). Interval: exact Poisson, or negative binomial with dispersion k; it does not include the uncertainty of r or k. 276 (80 to 1249); fc = 46 (published factor), k = 4.4 × f × fc Limits of detection LODπ: the EPG detected with probability π (0.5 or 0.95) in a single examination Entered profiles: LODπ = f × mπ(k) / r, with mπ(k) = k[(1 − π)−1/k − 1]. Calibrated profiles: the same model fitted to the raw counts. Built-in profiles: a detection curve with shape s, fitted to the published share of positive samples: LODπ = LOD50 × (−ln(1 − π) / ln 2)1/s. Built-in profile, fitted detection curve: LOD50 25 EPG, LOD95 154 EPG Counting variants as a statistical model Diagram of the four counting variants as sampling fractions, with volume read, nominal factor, recovery and dispersion, and of the path from a count to the nominal and corrected EPG, their intervals and the limits of detection. A Counting variants as sampling fractions two-cell chamber: areas in P1, Fig. 2 One grid the engraved grid of one cell Volume read 0.15 ml Nominal factor f 100 Recovery r 0.436 95% range 0.344 to 0.533 Dispersion k 12.8 95% range 1.82 to ∞ Two grids one grid in each cell Volume read 0.30 ml Nominal factor f 50 Recovery r 0.423 95% range 0.354 to 0.494 Dispersion k 7.85 95% range 2.34 to ∞ p: share of the chamber's eggs on the two grids p = (fwhole / fgrids) × (rgrids / rwhole) = 0.3203 (E24) Whole chamber whole area of both cells Volume read 1.0 ml Nominal factor f 15 Recovery r 0.396 95% range 0.347 to 0.443 Dispersion k 4.36 95% range 2.62 to 10.1 Flotation slide a separate preparation: the cover slip of the tube Volume read not defined by a volume Nominal factor f 7 Recovery r 0.161 95% range 0.135 to 0.187 Dispersion k 1.72 95% range 1.14 to 2.97 r and k: built-in profiles of Toxocara canis in dog faeces (E10a to E10d); egg loss = 1 − r; volume read on the scale of the chamber (1.5 ml) B From count to estimate and interval Count N eggs counted in the area read; replicate readings are pooled E04: N = 6, whole chamber, T. canis, dog Nominal EPG = N × f Interval: exact Poisson; counting error only, no egg loss. 90 (33.0 to 195.9); f = 15 Corrected EPG = N × fc fc = f / r, except for the whole chamber of a built-in profile, where fc is the published factor: 46 (T. canis), 28 (Trichuris spp.), 21 (A. suum). Interval: exact Poisson, or negative binomial with dispersion k; it does not include the uncertainty of r or k. 276 (80 to 1249); fc = 46 (published factor), k = 4.4 Limits of detection LODπ: the EPG detected with probability π (0.5 or 0.95) in a single examination Entered profiles: LODπ = f × mπ(k) / r, with mπ(k) = k[(1 − π)−1/k − 1]. Calibrated profiles: the same model fitted to the raw counts. Built-in profiles: a detection curve with shape s, fitted to the published share of positive samples: LODπ = LOD50 × (−ln(1 − π) / ln 2)1/s. Built-in profile, fitted detection curve: LOD50 25 EPG, LOD95 154 EPG
Figure 2. Counting variants as a statistical model. (A) Each counting variant reads a fraction of the suspension: one grid (the engraved grid of one cell), two grids (one grid in each cell), the whole chamber (the whole area of both cells) or the flotation slide (a separate preparation). The bar shows the volume read that the nominal factor implies, on the scale of the chamber (1.5 ml); the flotation slide is not defined by a volume. A method profile adds the recovery r (egg loss is 1 − r) and the dispersion k between independently prepared samples, here the built-in profiles of Toxocara canis in dog faeces (examples E10a to E10d). The share p of the chamber's eggs that lie on the two grids links the two grids with the whole chamber in the sequential reading protocol; it follows from the two profiles as p = (f of the whole chamber / f of the two grids) × (r of the two grids / r of the whole chamber) (example E24). (B) The count N gives the nominal EPG, N × f, with an exact Poisson interval, and the corrected EPG, N × fc, where fc = f / r, except for the whole chamber of a built-in profile, where fc is the published factor (46 (T. canis), 28 (Trichuris spp.), 21 (A. suum)). The interval of the corrected EPG is exact for Poisson or negative binomial counts with dispersion k; it does not include the uncertainty of r or k. The limits of detection come from the count model for entered and calibrated profiles and from the detection curve fitted to the published share of positive samples for built-in profiles. Worked values: example E04. The counting areas themselves are shown in Fig. 2 of P1. SVG file
Table 1. Counting variants as sampling fractions.
Variant (package value)Area readVolume read implied by the nominal factorNominal factorPublished whole-chamber factor
One grid (one_grid)the engraved grid of one cell0.15 ml100not applicable
Two grids (two_grids)two grids, one in each cell0.30 ml50not applicable
Whole chamber (whole_chamber)whole area of both cells1.0 ml; the chamber holds 1.5 ml1546 (T. canis), 28 (Trichuris spp.), 21 (A. suum)
Flotation slide (flotation_slide)the cover slip of a separate flotation preparationnot defined by a volume7not applicable

Notes to the table

  1. Whole chamber: the nominal factor 15 implies 1.0 ml read, although the chamber holds 1.5 ml (geometric factor 10). The spiked samples fit the nominal factor better than the geometric one, and the package keeps the nominal factor.
  2. Flotation slide: the nominal factor 7 underestimates the EPG about five- to nine-fold in the spiked samples (effective factor 38 to 65); report the corrected EPG for this variant (step C2).

GL5Built-in method profiles

The package holds one profile for each counting variant and each of the four combinations of egg type and faeces of the reference study: Toxocara canis, Trichuris spp. and Ascaris suum in dog faeces, and A. suum in pig faeces. The profiles were fitted to the published summary tables of the spiking study (levels 15, 25, 50, 100, 150, 200, 250, 300 eggs/g; 20 replicates; eggs added to dog and pig faeces free of eggs); GL8 states what this basis does not cover, in particular for Trichuris spp. The table below is built from the output of mcmaster-epg profile for every combination (examples E10a to E10p): the nominal factor, the recovery with its 95% range, the dispersion k with its 95% range ("none (Poisson)" when no overdispersion was found), and LOD50 and LOD95 with their intervals.

Table 2. Built-in method profiles, as printed by mcmaster-epg profile (examples E10a to E10p).
ParasiteFaecesVariantFactorRecovery (95% range)Dispersion k (95% range)LOD50, EPG (95% CI)LOD95, EPG (95% CI)
Toxocara canisdogone grid1000.4360.344 to 0.53312.81.82 to ∞163.0121.5 to 231.6883.3506.7 to 2807.1
Toxocara canisdogtwo grids500.4230.354 to 0.4947.852.34 to ∞64.241.7 to 88.4430.7290.4 to 865.0
Toxocara canisdogwhole chamber150.3960.347 to 0.4434.362.62 to 10.125.114.2 to 37.2154.2111.0 to 240.0
Toxocara canisdogflotation slide70.1610.135 to 0.1871.721.14 to 2.9732.717.8 to 49.4266.6185.4 to 475.8
Trichuris spp.dogone grid1000.8040.696 to 0.928none (Poisson)4.57 to ∞58.037.7 to 79.7359.5249.6 to 667.7
Trichuris spp.dogtwo grids500.8050.718 to 0.88917.85.28 to ∞31.316.2 to 48.0277.3186.9 to 539.2
Trichuris spp.dogwhole chamber150.70.648 to 0.75324.511 to ∞10.93.4 to 16.739.027.2 to 73.8
Trichuris spp.dogflotation slide70.1080.0913 to 0.1233.561.87 to 11.131.115.3 to 48.4303.7198.2 to 650.3
Ascaris suumdogone grid1000.9860.822 to 1.1441.86 to 15661.935.8 to 90.4651.3376.5 to 2008.5
Ascaris suumdogtwo grids500.9880.852 to 1.115.012.71 to 23.317.15.7 to 31.3267.0167.5 to 626.7
Ascaris suumdogwhole chamber150.7240.67 to 0.77724.110.5 to ∞7.71.5 to 14.545.029.8 to 84.5
Ascaris suumdogflotation slide70.1860.163 to 0.2094.072.46 to 8.9718.28.2 to 29.4146.6100.9 to 249.8
Ascaris suumpigone grid1001.030.881 to 1.185.522.19 to ∞50.431.9 to 70.3319.6226.8 to 557.3
Ascaris suumpigtwo grids501.010.882 to 1.145.843.17 to 29.118.06.7 to 31.7233.8152.3 to 483.8
Ascaris suumpigwhole chamber150.740.697 to 0.796none (Poisson)31.3 to ∞13.56.2 to 18.637.827.4 to 68.3
Ascaris suumpigflotation slide70.1820.162 to 0.2026.913.74 to 29.425.715.2 to 37.0133.896.2 to 205.8

Notes to the table

  1. The built-in profiles describe one laboratory, one chamber type (FiBL), three egg types and dog and pig faeces. For any other procedure enter or calibrate a profile (Section B).
  2. Values as printed by mcmaster-epg profile: recovery and k to three significant digits, LOD50 and LOD95 to one decimal. none (Poisson): no overdispersion was found, so k is infinite; ∞ (printed inf by the program): the 95% range of k has no upper limit.
  3. The tables of Kochanowski et al. (2013) name the species Trichuris ovis; the title of the paper refers to Trichuris species. This protocol writes Trichuris spp.; the command-line value is trichuris. On the origin of these eggs and its consequence for the profiles, see GL8.

GL6Statistical basis

Each procedure below is described as implemented in mcmaster-epg [2]; the package README (section "Methods") gives the full account.

Nominal EPG and the exact Poisson interval. The nominal EPG is the count times the factor. Its interval is the exact (Garwood) Poisson interval of the count, scaled by the factor. It covers counting error only and makes no correction for egg loss.

Negative binomial interval. When the profile has a finite dispersion k (variance = mean + mean2/k), the interval of the corrected EPG is obtained by exact inversion of the negative binomial distribution, so it includes the variation between preparations; it does not include the uncertainty of the recovery or of k. Replicate readings of one sample are pooled. The Poisson interval is too narrow when samples differ more than counting error explains.

Index of dispersion. For two or more readings of one sample the package reports the Poisson index of dispersion and its p-value [6]. A small p means that the readings vary more than counting error explains and that the Poisson interval is too narrow.

Count model. Counts are negative binomial with mean recovery × EPG / factor and dispersion k (Poisson when k is infinite). For the built-in profiles the model was fitted to the published mean and standard deviation of ln(count + 1) [5].

Calibration. Counts of spiked samples are fitted by maximum likelihood. Recovery, k and the limits of detection receive profile-likelihood intervals, the other parameter profiled out; the parameter ranges that the herd calculations need are stored in the profile together with the calibration data. Proportionality of the mean count to the level is tested against log mean = a + b log level (likelihood ratio, b = 1), overdispersion against Poisson counts (likelihood ratio, half the chi-square tail at the boundary). Entered 95% intervals are converted to other levels assuming a normal distribution of the logarithm of the parameter.

Limits of detection. With π the probability of detection (0.5 or 0.95), entered profiles give LODπ = f × mπ(k) / r, where mπ(k) = k[(1 − π)−1/k − 1] is the mean count at which P(count ≥ 1) = π. Calibrated profiles take the limits from the same count model fitted to the raw counts (profile likelihood). Built-in profiles take them from the detection curve fitted to the published share of positive spiked samples, LODπ = LOD50 × (−ln(1 − π) / ln 2)1/s, with s the shape of the curve. Without a profile, lod gives the Poisson limit of the nominal method, which is lower than the observed one.

Detection curve. POD = 1 − exp(−ln 2 × (EPG / LOD50)slope), fitted by binomial maximum likelihood with profile-likelihood intervals. Slope 1 is the complementary log-log model of Wilrich and Wilrich [7]; the spiked samples require a slope below 1 in most combinations. In a calibration the curve is fitted to the share of positive samples only and is reported as an independent check, with a parametric-bootstrap goodness-of-fit test.

Herd limits without assumptions. For a count c let qc be the fraction of animals with a count of at least c and sc the probability of such a count at the threshold EPG t. Because this probability rises with EPG, for every distribution of EPG among the animals the fraction at or above t lies between (qc − sc)/(1 − sc) and qc/sc. The package combines several counts c, chosen from the design and not from the data, with exact binomial intervals for their qc under a Bonferroni split, and solves a linear programme over all distributions of EPG consistent with them. Uncertainty of recovery and k enters through bootstrap percentiles; half of 1 − conf goes to the herd data and half to the parameters.

Gamma aggregation model. A fraction of the animals is infected and their EPG follows a gamma distribution with free shape and mean; counts follow the count model of the profile. The model is fitted by maximum likelihood with profile-likelihood intervals, which in small herds are calibrated by a parametric bootstrap (200 bootstrap herds below 60 animals). A goodness-of-fit test (deviance of the counts in classes, with a p-value from the same bootstrap herds) checks the model in every herd.

Survey size. Every animal at or above t is positive with probability at least s1(t), taken at the least favourable end of the 95% parameter range. Then n = ln(1 − conf) / ln(1 − fraction × s1(t)) animals give at least one positive with probability conf, whatever the other animals carry.

Replicate planning. The coefficient of variation of the mean of n independent counts is sqrt((1/mean + 1/k) / n). With a profile the recovery and k of its count model are used.

Sequential interval. The records of all three stages are ordered by their EPG estimate. A true EPG belongs to the interval of an observed record with estimate x when, at that EPG, both P(estimate ≥ x) and P(estimate ≤ x) exceed (1 − conf)/2; the set is found on a grid of log(EPG), its ends are refined by root finding, and the interval is its hull. With known parameters the coverage is at least conf for every true EPG over all records. With parameter ranges half of 1 − conf goes to the parameters and the limits are taken over the corners of the ranges.

GL7Assumptions

  • The method profile describes the procedure that produced the counts: chamber, dilution, flotation solution, counting variant, host faeces and egg type. The built-in profiles describe the procedure of the reference study.
  • Counts follow the count model of the profile: negative binomial with mean recovery × EPG / factor and dispersion k between independently prepared samples.
  • Recovery does not depend on the EPG level; a calibration tests this.
  • Replicates and spiked calibration samples are prepared independently; this is assumed and cannot be tested from the counts.
  • Every positive count is an egg of the target parasite: there are no false positives.
  • Herds: one examination per animal, independent examinations, and animals whose egg loss resembles that of the spiked samples.
  • Gamma aggregation model: the EPG of infected animals follows a gamma distribution; the model check tests this.
  • Sequential protocol: the two grids see a share p of the eggs of the same chamber filling; the flotation slide is a separate preparation; the stages are read in the order grids, whole chamber, slide.

GL8Limitations

  • The built-in profiles come from one laboratory, one chamber type, three egg types and dog and pig faeces, and were fitted to the published summary tables. For other procedures calibrate from your own spiked samples or enter published parameters.
  • All validation of the reference study used eggs added to faeces free of parasite eggs, as confirmed by double flotation according to Fülleborn [8], not eggs shed by naturally infected animals [5].
  • Trichuris spp.: the Trichuris eggs of the reference study were eggs of T. ovis from females taken from the caecum of experimentally infected mice, spiked into dog faeces [5]. Neither the dog whipworm T. vulpis nor samples from naturally infected dogs were tested. The built-in Trichuris spp. profiles are therefore an extrapolation, to be confirmed locally, for example by calibration with spiked samples (step B3).
  • Detection limits above the highest spiking level (300 eggs/g for the built-in profiles) are extrapolations; the output marks them.
  • The published whole-chamber factors are 1/slope of regressions with a positive intercept; as plain multipliers they overestimate, most at low counts.
  • Without --recovery-ci and --k-ci the limits of detection and the herd and survey results treat entered parameters as known. The interval of the corrected EPG never includes the uncertainty of recovery or k, with or without these options.
  • The model check of the herd analysis detects strongly bimodal herds but not every departure from the gamma distribution. The limits without assumptions need no such check, but they are wide.
  • Prevalence of infection has no upper limit without assumptions: an animal with a very low EPG is almost always negative, so negative results never exclude that all animals are infected.
  • Sequential protocol: the package does not estimate p from data. The derived value follows from the recoveries of the profiles; if the grids hold a different share of the chamber's eggs in your laboratory, give p explicitly.
  • Sequential protocol: exactly three stages, in the order grids, chamber, slide. The grid profile enters only through p; counts on the grids follow the chamber's dispersion.
  • Sequential protocol: the limits of detection use the count model, not a detection curve fitted to the protocol.
  • Sequential protocol: the coverage of the interval holds over all records, not for each stage, and the estimate is biased upwards at low EPG; near the limit of detection read the interval, not the estimate alone.
  • Sequential protocol: with parameter ranges only the confidence levels stored in the profiles are available, namely 0.90, 0.95, 0.975 (sequential_epg); 0.95, 0.975, 0.9875 (protocol_lod). The coverage inside the ranges was checked by simulation, not proved.
  • Sequential protocol: there is no command-line subcommand and there are no herd functions yet; use the Python library or the form of the browser application.

GL9Validation at a glance

Main results of the validation reports of the package, as summarised in its README; each item names the report that holds the full results.

  • The published tables are internally consistent: the limits of detection in Table 4 of Kochanowski et al. (2013) are reproduced from the shares of positive samples in Table 3 of Kochanowski et al. (2013) for 16 of 16 combinations of egg type, faeces and counting variant. Source: validation/REPORT.md
  • The two-parameter detection curve is not rejected in 16 of 16 combinations (parametric bootstrap of the deviance). Source: validation/REPORT.md
  • The Poisson interval keeps its coverage only if counts are Poisson: at the dispersion found for Toxocara canis (k = 4.4) its mean coverage falls to 74%, while the negative binomial interval keeps the nominal 95%. Source: validation/REPORT.md, section 6
  • Calibration in the spiking design of the reference study: the 95% intervals of recovery, k, LOD50 and LOD95 contain the true value in 94.4% to 98.0% of simulated studies. Source: validation/CALIBRATION_REPORT.md
  • Herd limits without assumptions contain the true fraction at or above the threshold in at least 99.7% of simulated herds in every scenario, including the least favourable distributions. Source: validation/HERD_REPORT.md
  • Sequential protocol: with known parameters the exact coverage of the interval of sequential_epg is at least 0.954 at conf 0.95, for every true EPG examined. Source: validation/PROTOCOL_REPORT.md
  • The share p was estimated from the 2013 data and from published spiking studies of gastrointestinal nematode eggs in cattle, sheep and horse faeces [9] [10]. The literature values (0.3072 to 0.3240) lie inside the recommended range of every built-in combination, but below the 2013 estimates for A. suum. A third study read only the grids and gives no information on p [11]. Source: validation/PROTOCOL_P_REPORT.md

GL10Licence and reuse

Text and figures of this protocol: Creative Commons Attribution 4.0 International (CC BY 4.0). Software mcmaster-epg: MIT licence (LICENSE). The protocol may be copied, adapted and redistributed with attribution (step G3).

2Materials

P2 needs no laboratory materials of its own: the flotation solution, the equipment, the bench procedure and the safety at the bench are described in P1. The table lists what P2 takes from the bench and where it comes from.

Table 3. Inputs from the bench.
ItemSpecificationSource
Counting variantOne grid, two grids (one in each cell), whole chamber (whole area of both cells) or flotation slide; package values one_grid, two_grids, whole_chamber, flotation_slide. In the sequential protocol: the stage at which the reading stopped.P1, steps 13 and 16
Raw count per egg typeThe number of eggs of each egg type counted in one reading; never the product count × factor.P1, step 16
Number of readingsOne reading per sample, or several replicate readings of independently prepared portions (step A3).P1, step 16
Host and faecesDog or pig faeces for the built-in profiles (--matrix).P1, step 16
Egg typeToxocara canis, Trichuris spp. or Ascaris suum for the built-in profiles (--species); other egg types need an entered or calibrated profile.P1, step 18
Method profileBuilt in, entered or calibrated (Section B); it must describe the procedure that produced the counts (step A4).this protocol
Dilution and nominal factorsAs stated in GL2 and Table 1; the only bench values that the calculations use.P1; Kochanowski et al. 2013
Spiked samples (calibration only, step B3)Faeces free of eggs spiked with known numbers of eggs, in the design of the reference study (levels 15, 25, 50, 100, 150, 200, 250, 300 eggs/g; 20 replicates) or in your own design; the spiking technique is that of the reference study.Kochanowski et al. 2013, Materials and Methods

The command line, the Python library and the browser application run the same package and give identical results.

Table 4. Software.
ItemSpecificationLink
mcmaster-epg 1.1.1Python package with the command mcmaster-epg and the Python library mcmaster_epg. Install with pip install mcmaster-epg. MIT licence; concept DOI 10.5281/zenodo.24662026.https://pypi.org/project/mcmaster-epg/
Python, NumPy, SciPyPython 3.10 or later; NumPy 1.22 or later and SciPy 1.8 or later, installed with the package.https://www.python.org/
Optional extra validationpip install mcmaster-epg[validation] (matplotlib, SciencePlots); needed only to reproduce the validation reports.https://github.com/maciejkochanowski/mcmaster-epg
Browser applicationNo installation: the same package runs in the browser (Pyodide, WebAssembly), with one form per command and a form for the sequential reading protocol. The first visit downloads the Python runtime. Run times: 10 to 20 s at the first visit; up to a minute for the herd bootstrap or calibrate. Nothing typed or uploaded leaves the device; the page uses no cookies, analytics or local storage.https://maciejkochanowski.github.io/mcmaster-epg/
BiocondaRecipe submitted; pending acceptance, not yet available.
Source code, example files and this protocolGitHub repository; examples/spiked_example.csv (simulated spiked samples) and docs/protocol/data/ (synthetic example files of this protocol).https://github.com/maciejkochanowski/mcmaster-epg
Tools for reduction tests and hierarchical modelseggCounts, bayescount or fecrt.com; they take the raw count and correction factor that mcmaster-epg exports (step G1). Not required for this protocol.

3Safety warnings

Work at the bench, including the handling of faeces and egg suspensions that may contain infective, zoonotic eggs of Toxocara and Ascaris, follows the safety notes of P1 and the rules of your institution.

The software is a research and teaching tool. Its results are only as good as the method profile and the counts; they do not replace the judgement of the laboratory.

4Before start

  1. Define the question

    Use the decision guide below (Table 5, Fig. 3) to match the question to a task, a command and the steps of this protocol.

  2. Obtain the counts and record the method

    Obtain the raw counts by P1 and record the method completely: counting variant, reading rule (one variant, or the sequential protocol) and dilution. The method profile must describe exactly this method (step A4).

  3. Choose the route to a method profile

    Built in only if the method equals the procedure of the reference study (two-cell FiBL chamber, Raynaud's dilution and factors, a validated egg type in dog or pig faeces); otherwise entered from a publication (step B2) or calibrated from your own spiked samples (step B3).

  4. Install or open the software

    Install with pip install mcmaster-epg and check the version with python -c "import mcmaster_epg; print(mcmaster_epg.__version__)", which should print 1.1.1 (software in Table 4). Alternatively open the browser application and wait until its buttons read Calculate.

  5. Prepare the input table

    The record sheet of P1 (its step 16) with, in addition, the stage at which a sequential reading stopped and the replicate index (steps A1 and A2).

  6. For herds

    Plan one count per animal from independent examinations (step F1).

5Decision guide

Find the question, then follow the step. Commands are shown in general form: replace the capitals by values. Each task has a form of the same name in the browser application.

Choosing a task Decision tree leading from typical questions to the commands epg, batch, lod, plan, profile, calibrate, sequential, herd and survey. What do you need to know? B Choose the method profile What are the parameters of a built-in profile? profile mcmaster-epg profile --variant V --species S [--matrix pig] #profile step B1 My procedure is not the 2013 procedure. profile, calibrate mcmaster-epg profile ... --out FILE.json; mcmaster-epg calibrate SPIKED.csv --multiplier F #calibrate steps B2, B3, B4 C Single samples What is the EPG of one sample, and how certain is it? epg mcmaster-epg epg COUNT --variant V [--species S] #epg steps C1, C2 Do several readings of one sample agree? epg with replicates mcmaster-epg epg N1 N2 ... --variant V #epg step C3 How do I analyse many samples at once? batch mcmaster-epg batch FILE.csv #batch step C5 D Detection limits and replicate planning What is the smallest EPG that the method detects? lod mcmaster-epg lod --variant V [--species S] --probability 0.5 (or 0.95) #lod step D1 How many replicate preparations give the precision I need? plan mcmaster-epg plan EPG --variant V --cv CV [--species S] #plan step D2 E Sequential reading protocol I read the grids first, then the whole chamber, then a slide. sequential sequential_epg(stage, count, protocol) (Python), or the Sequential reading form #sequential steps E1 to E5 F Herds Herd: what are the mean EPG and the share of animals above a treatment threshold? herd mcmaster-epg herd COUNTS --variant V --species S --threshold T #herd steps F1 to F4 Herd: how many animals must I examine to find infection? survey mcmaster-epg survey --variant V --species S --prevalence P --threshold T #survey step F5 G Reporting and citing How do I pass the data to eggCounts or a reduction test? epg --json mcmaster-epg epg ... --json (fields total_count, cf_total) #epg step G1 Choosing a task Decision tree leading from typical questions to the commands epg, batch, lod, plan, profile, calibrate, sequential, herd and survey. What do you need to know? B Choose the method profile What are the parameters of a built-in profile? profile mcmaster-epg profile --variant V --species S [--matrix pig] #profile step B1 My procedure is not the 2013 procedure. profile, calibrate mcmaster-epg profile ... --out FILE.json; mcmaster-epg calibrate SPIKED.csv --multiplier F #calibrate steps B2, B3, B4 C Single samples What is the EPG of one sample, and how certain is it? epg mcmaster-epg epg COUNT --variant V [--species S] #epg steps C1, C2 Do several readings of one sample agree? epg with replicates mcmaster-epg epg N1 N2 ... --variant V #epg step C3 How do I analyse many samples at once? batch mcmaster-epg batch FILE.csv #batch step C5 D Detection limits and replicate planning What is the smallest EPG that the method detects? lod mcmaster-epg lod --variant V [--species S] --probability 0.5 (or 0.95) #lod step D1 How many replicate preparations give the precision I need? plan mcmaster-epg plan EPG --variant V --cv CV [--species S] #plan step D2 E Sequential reading protocol I read the grids first, then the whole chamber, then a slide. sequential sequential_epg(stage, count, protocol) (Python), or the Sequential reading form #sequential steps E1 to E5 F Herds Herd: what are the mean EPG and the share of animals above a treatment threshold? herd mcmaster-epg herd COUNTS --variant V --species S --threshold T #herd steps F1 to F4 Herd: how many animals must I examine to find infection? survey mcmaster-epg survey --variant V --species S --prevalence P --threshold T #survey step F5 G Reporting and citing How do I pass the data to eggCounts or a reduction test? epg --json mcmaster-epg epg ... --json (fields total_count, cf_total) #epg step G1
Figure 3. Choosing a task. An index, grouped by section of this protocol, from typical questions to the command, the form of the browser application and the steps (see the decision guide). SVG file
Table 5. Decision guide: from the question to the task.
QuestionTaskCommand or functionBrowser formSteps
What is the EPG of one sample, and how certain is it?epgmcmaster-epg epg COUNT --variant V [--species S]#epgC1, C2
Do several readings of one sample agree?epg with replicatesmcmaster-epg epg N1 N2 ... --variant V#epgC3
How do I analyse many samples at once?batchmcmaster-epg batch FILE.csv#batchC5
What is the smallest EPG that the method detects?lodmcmaster-epg lod --variant V [--species S] --probability 0.5 (or 0.95)#lodD1
How many replicate preparations give the precision I need?planmcmaster-epg plan EPG --variant V --cv CV [--species S]#planD2
What are the parameters of a built-in profile?profilemcmaster-epg profile --variant V --species S [--matrix pig]#profileB1
My procedure is not the 2013 procedure.profile, calibratemcmaster-epg profile ... --out FILE.json; mcmaster-epg calibrate SPIKED.csv --multiplier F#calibrateB2, B3, B4
I read the grids first, then the whole chamber, then a slide.sequentialsequential_epg(stage, count, protocol) (Python), or the Sequential reading form#sequentialE1 to E5
Herd: what are the mean EPG and the share of animals above a treatment threshold?herdmcmaster-epg herd COUNTS --variant V --species S --threshold T#herdF1 to F4
Herd: how many animals must I examine to find infection?surveymcmaster-epg survey --variant V --species S --prevalence P --threshold T#surveyF5
How do I pass the data to eggCounts or a reduction test?epg --jsonmcmaster-epg epg ... --json (fields total_count, cf_total)#epgG1

AInputs from the bench

The counts come from the bench and follow P1. Steps A1 to A4 define what this protocol needs from that work and check that the method profile fits it; none of them replaces a step of P1.

Step A1: Take the inputs from the bench record

Bench
Purpose

Give every sample one unambiguous input for the calculations.

Action

Obtain the counts by the laboratory protocol P1, Kochanowski M, Dąbrowska J. Quantitative faecal egg count by the McMaster technique (Raynaud's modification). protocols.io. DOI: [to be inserted on publication], and take from its record sheet (P1, step 16; Table 3): the counting variant, the raw count per egg type, the number of readings, the host and faeces, the egg type and the method profile to be used. The counting areas of the two-cell McMaster chamber, one grid (the engraved grid of one cell), two grids (one in each cell), whole chamber (whole area of both cells) and flotation slide, are shown in Fig. 2 of P1 and defined in GL3.

In the web app

Browser application → One sample (#epg): Eggs counted (the raw counts), Counting factor → Counting variant, Egg loss and dispersion → Built-in parasite and faeces (egg type and faeces) or Method profile file.

Expected result

An input table with one row per sample: sample, counting variant, egg type, faeces, number of readings and raw counts. For sample D-017 of P1, which Section C continues: whole chamber, Toxocara canis, dog, one reading, 6 eggs.

Note

Egg types without a built-in profile are analysed with the nominal method or with an entered or calibrated profile (Section B).

Step A2: Keep the stage and the raw count

Bench
Purpose

Keep the information that the analyses need; the product count × factor discards it.

Action

Record the raw count of every reading and, when the reading follows the sequential protocol (Section E), the stage at which it stopped. The nominal EPG, count × factor, is calculated in P1 (step 17) and is not repeated here; do not store it in place of the count.

In the web app

Browser application → Sequential reading (#sequential): Stage at which the reading stopped, Eggs counted at that stage.

Expected result

A record with the stage or counting variant and the raw count of every reading.

Note

The interval of the sequential protocol (step E2) and the checks of stored values (step E4) need the stage and the count. In the sequential protocol a stored product overstates low EPG, because a sample with one egg on the grids is stored with the large factor while a sample without eggs there is read further (README, Sequential reading protocol).

Step A3: Treat replicates as independent preparations

Bench
Purpose

Capture the variation between preparations, not only counting error.

Action

Enter several counts of one sample only if each comes from an independently prepared portion, prepared as P1 prepares a sample: a new portion of faeces, a new suspension and a new filling. A second reading of the same filling is not a replicate.

In the web app

Browser application → One sample (#epg) → Eggs counted: several numbers, separated by spaces or commas, are replicate readings of the same sample.

Expected result

Independent counts of one sample, for step C3 or for replicate planning (step D2).

Note

The dispersion k of a profile describes variation between independently prepared samples, not re-readings of one chamber. The negative binomial intervals and replicate planning rely on that definition.

Step A4: Check that the method profile matches the method

Software
Purpose

Make sure that the factor and the method profile describe the procedure that produced the counts.

Action

Compare the counting variant, the dilution and the factor with GL2 and Table 1. The built-in profiles apply only to the procedure of the reference study [5]. For another dilution or volume read give --counted-ml with --faeces-g and --flotation-ml, which compute the geometric factor; egg loss for such a procedure must be entered or calibrated (Section B). The example compares the variant with the volumes for 7 eggs in the whole chamber and shows the same calculation in Python.

Command
mcmaster-epg epg 7 --variant whole_chamber
mcmaster-epg epg 7 --counted-ml 1.0 --faeces-g 2 --flotation-ml 28
python docs/protocol/tools/api_example.py
In the web app

Browser application → One sample (#epg) → Counting factor: Counting variant, or Volume read with Faeces and Flotation solution → Egg loss and dispersion: None → Calculate.

Expected result

The variant and the volumes give the same nominal EPG and exact interval, because the dilution of GL2 read over 1.0 ml implies the whole-chamber factor:

Output of example E01
$ mcmaster-epg epg 7 --variant whole_chamber
EPG 105 (95% CI 42.2 to 216.3)
Output of example E05
$ mcmaster-epg epg 7 --counted-ml 1.0 --faeces-g 2 --flotation-ml 28
EPG 105 (95% CI 42.2 to 216.3)

The Python library gives the same values; the session also shows the Poisson limit of detection, replicate planning, the fitted limits of a built-in profile, a factor from volumes and an entered profile:

Output of example E20
$ python docs/protocol/tools/api_example.py
>>> from mcmaster_epg import (epg, epg_ci, detection_limit, replicates_for_cv,
...                           fitted_limits, multiplier)
>>> from mcmaster_epg.profile import manual_profile
>>> epg(7, 15)
105
>>> epg_ci(7, 15)
(42.215445772798006, 216.34013042553565)
>>> round(detection_limit(15, probability=0.95), 1)
44.9
>>> replicates_for_cv(150, 15, target_cv=0.1)
10
>>> lim = fitted_limits("toxocara_canis", "dog", "whole_chamber")
>>> {k: tuple(round(x, 1) for x in v) for k, v in lim.items()}
{'lod50': (25.1, 14.2, 37.2), 'lod95': (154.2, 111.0, 240.0)}
>>> multiplier(mass_g=2, suspension_ml=30, counted_ml=0.15)
100.0
>>> paper = manual_profile(50, recovery=0.6, k=6, recovery_ci=(0.5, 0.7))
>>> print(paper.describe())
entered parameters: factor 50, recovery 0.6 (95% range 0.5 to 0.7), dispersion k 6 (95% range 6 to 6)
Warning

The nominal factor 7 of the flotation slide underestimates the EPG about five- to nine-fold in the spiked samples (effective factor 38 to 65); report the corrected EPG for this variant (step C2).

Open in the app: Open the One sample form

BChoose the method profile

A method profile describes one procedure completely: factor, recovery, dispersion and their uncertainty. Choose the route in this order: built in if the procedure is the 2013 procedure in every respect (B1); entered if a publication gives recovery and dispersion for your procedure (B2); calibrated if you can spike faeces with known numbers of eggs (B3). Every command then uses the profile in the same way (B4).

Step B1: Use a built-in profile

Software
Purpose

Apply the parameters estimated from the spiked samples of the reference study when the procedure is identical.

Action

Print the profile for the counting variant, egg type and faeces you use; add --out FILE.json to save it. --matrix pig is accepted only with --species ascaris_suum.

Command
mcmaster-epg profile --variant whole_chamber --species ascaris_suum --matrix pig
In the web app

Browser application → Method profile (#profile) → Counting factor: Counting variant, Area read: whole chamber (factor 15) → Egg loss and dispersion: Built-in parasite and faeces, Parasite: Ascaris suum, Faeces: pig → Calculate → Download profile (JSON).

Expected result

Two lines: the profile name with the factor, the recovery with its 95% range and the dispersion k with its 95% range; then LOD50 and LOD95 with their intervals.

Output of example E10o
$ mcmaster-epg profile --variant whole_chamber --species ascaris_suum --matrix pig
ascaris_suum, pig, whole chamber (Kochanowski et al. 2013): factor 15, recovery 0.74 (95% range 0.697 to 0.796), dispersion k none (Poisson) (95% range 31.3 to inf)
LOD50 13.5 EPG (6.2 to 18.6), LOD95 37.8 EPG (27.4 to 68.3)

Here the dispersion is "none (Poisson)": no overdispersion was found for this combination, and the upper end of the range of k is infinite.

Warning

A built-in profile is valid only for the procedure of the reference study (step A4). Combinations that the reference study did not validate stop with an error (Troubleshooting, T03).

Open in the app: Open the Method profile form

Step B2: Enter parameters from a publication

Software
Purpose

Describe a procedure validated elsewhere by its factor, recovery and dispersion.

Action

Give the factor (--variant, --multiplier or --counted-ml), the recovery with its 95% interval (--recovery, --recovery-ci LOW HIGH) and k with its 95% interval (--k, --k-ci LOW HIGH; inf is allowed as the upper limit). Save them with profile --out, or pass them directly to any command.

Command
mcmaster-epg profile --multiplier 50 --recovery 0.6 --recovery-ci 0.5 0.7 --k 6 --out paper.json
mcmaster-epg epg 3 --multiplier 50 --recovery 0.6 --recovery-ci 0.5 0.7 --k 6
In the web app

Browser application → One sample (#epg) → Egg loss and dispersion: Entered by hand → Recovery with its lower and upper limit, k → Calculate.

Expected result

The first command describes and saves the profile; the second applies the same parameters to a count. The corrected factor is factor / recovery, marked "entered recovery", and the interval includes k.

Output of example E11
$ mcmaster-epg profile --multiplier 50 --recovery 0.6 --recovery-ci 0.5 0.7 --k 6 --out paper.json
entered parameters: factor 50, recovery 0.6 (95% range 0.5 to 0.7), dispersion k 6 (95% range 6 to 6)
LOD50 61.2 EPG (52.5 to 73.5), LOD95 323.8 EPG (277.5 to 388.5)
written to paper.json
$ mcmaster-epg epg 3 --multiplier 50 --recovery 0.6 --recovery-ci 0.5 0.7 --k 6
EPG 150 (95% CI 30.9 to 438.4)
Corrected EPG 250 (95% CI 47 to 1171), factor 83.3 (entered recovery)
  interval includes between-sample dispersion k = 6.0
LOD50 61 EPG (52 to 73), LOD95 324 EPG (278 to 389)
Note

--recovery-ci and --k-ci affect only the limits of detection and the herd and survey results; without them these treat the parameters as known. The interval of the corrected EPG is the same with or without them: it never includes the uncertainty of recovery or k. Entered 95% intervals are converted to other levels assuming a normal distribution of the logarithm of the parameter. When no interval of k is given, its range collapses to the point value, as the first line of the output shows.

Open in the app: Open the One sample form

Step B3: Calibrate from spiked samples

Software
Purpose

Estimate recovery, dispersion and limits of detection for your own procedure: any chamber, dilution, flotation solution, host and parasite.

Action

Design. Spike faeces free of eggs with known numbers of eggs at several levels, with more levels near the expected limit of detection. Precision of the recovery, from the package README: 8 levels × 20 samples: recovery about ±12%; 5 levels × 10 samples: about ±21%.

Doses. Count the eggs of each dose individually, with the spiking technique of the reference study [5].

Preparation. Prepare and read every spiked sample independently and exactly as a routine sample (P1), one reading per sample.

Data file. One row per sample with the columns sample,level,count (level: eggs per gram added; count: eggs counted in one reading). Comma, semicolon or tab separated; decimal comma accepted.

Fit. Run calibrate with the factor of the reading and a name for the method.

Check. Read the report before using the profile (see Expected result).

Command
mcmaster-epg calibrate examples/spiked_example.csv --multiplier 50 --name "example lab, two grids" --out lab.json --report lab.md
In the web app

Browser application → Calibrate (#calibrate) → Spiked samples (CSV file): choose a file, or Load the example file → Counting factor of the reading: Multiplication factor 50 → Method name → Calculate → Download profile (JSON), Download report (Markdown), or Use this profile in the other tools.

Expected result

The command writes the profile lab.json and the report lab.md, and prints the profile:

Output of example E12
$ mcmaster-epg calibrate examples/spiked_example.csv --multiplier 50 --name "example lab, two grids" --out lab.json --report lab.md
profile written to lab.json, report to lab.md
example lab, two grids: factor 50, recovery 0.621 (95% range 0.485 to 0.798), dispersion k 2.46 (95% range 1.27 to 4.99)

The report (lab.md) gives the estimates with profile-likelihood intervals, the checks and observed against predicted values at every level:

Output of example E12b 33 lines
$ lab.md
# Calibration: example lab, two grids

60 spiked samples at 6 levels (25 to 800 eggs/g); nominal factor 50.

## Estimates

| Parameter | Estimate | 95% interval |
|---|---:|---:|
| Recovery | 0.621 | 0.485 to 0.798 (profile likelihood) |
| Corrected factor (factor / recovery) | 80.6 | 62.6 to 103.1 |
| Dispersion k | 2.46 | 1.27 to 4.99 (profile likelihood) |
| LOD50 (eggs/g) | 64.5 | 50.2 to 86.3 (count model, profile likelihood) |
| LOD95 (eggs/g) | 471.6 | 306.4 to 1016.8 (count model, profile likelihood) |

## Checks

- Linearity: slope of log mean count on log level 0.994; test of slope 1: p = 0.957.
- Overdispersion against Poisson: p = 1.6e-13.
- Detection curve fitted to the share of positive samples (independent of the count model): LOD50 54.7 (22.8 to 90.9), LOD95 301.3 (167.6 to 901.3), slope 0.86 (1 = Poisson-like); goodness of fit p = 0.286.

## Levels

| Level (eggs/g) | Samples | Mean count | SD | Positive | Predicted mean | Predicted positive |
|---:|---:|---:|---:|---:|---:|---:|
| 25 | 10 | 0.70 | 0.82 | 50% | 0.31 | 25% |
| 50 | 10 | 0.50 | 0.85 | 30% | 0.62 | 43% |
| 100 | 10 | 1.00 | 1.05 | 60% | 1.24 | 63% |
| 200 | 10 | 2.20 | 1.62 | 90% | 2.48 | 82% |
| 400 | 10 | 3.40 | 1.58 | 100% | 4.97 | 93% |
| 800 | 10 | 12.80 | 10.63 | 100% | 9.93 | 98% |

Model: counts negative binomial with mean recovery x level / factor and dispersion k, fitted by maximum likelihood; each row is assumed to be an independently prepared spiked sample.

Before using the profile, read the three checks. Linearity: the slope of log mean count on log level should be close to 1, and the test of slope 1 should give no evidence against proportionality. Overdispersion: a small p shows that counts vary more than Poisson counts, so a finite k is needed. Detection curve: an independent fit to the share of positive samples; its goodness of fit should not reject it. In the levels table, observed and predicted means and shares of positive samples should agree within the variation expected from the number of samples per level.

Note

The example file is simulated (60 samples, 6 levels from 25 to 800 eggs/g, 10 each, factor 50, true recovery 0.6, k = 6) and shows only the format (examples/README.md). In this draw the 95% interval of k does not contain the value used in the simulation, as a 95% interval fails to do in about one study in twenty; the other intervals contain their true values.

Warning

Counts must come from independently prepared samples, not from re-reading one chamber: the calibration assumes this and cannot test it.

Open in the app: Open the Calibrate form

Step B4: Use and share the profile

Software
Purpose

Apply the calibrated or entered parameters to every analysis and keep them with the results.

Action

Pass the file with --profile to epg, lod, plan, herd, survey or batch. The profile contains its own factor; leave out --variant, --multiplier and --counted-ml.

Command
mcmaster-epg epg 3 --profile lab.json
In the web app

Browser application → after Calibrate: Use this profile in the other tools; or in any form: Egg loss and dispersion → Method profile file → A file on this device.

Expected result

The corrected EPG now uses the calibrated factor ("calibrated recovery"), its interval includes the calibrated k, and the limits of detection come from the count model fitted to the spiked samples.

Output of example E13
$ mcmaster-epg epg 3 --profile lab.json
EPG 150 (95% CI 30.9 to 438.4)
Corrected EPG 242 (95% CI 40 to 2218), factor 80.6 (calibrated recovery)
  interval includes between-sample dispersion k = 2.5
LOD50 65 EPG (50 to 86), LOD95 472 EPG (306 to 1017)
Note

The JSON file holds the factor, the parameters with their ranges and the calibration data. Archive it with the results and name it in reports (step G2). In the browser a profile from the calibration is kept only until the page is reloaded; download it to keep it.

CSingle samples

Steps C1 to C3 continue sample D-017 of P1 [1]: dog faeces, whole chamber, one reading, 6 eggs of Toxocara canis. P1 calculates its nominal EPG (step 17) and shows the output of mcmaster-epg (step 18); this section explains every number of that output and what it supports. Every command takes the method in the same way: a factor (--variant, --multiplier, or --counted-ml with --faeces-g and --flotation-ml) and, optionally, one source of egg loss and dispersion (--profile, --species with --matrix, or --recovery and --k with their intervals). Without a source of egg loss the nominal method is used. What a correct result looks like is summarised in Table 6; error messages and warnings are explained in Table 7.

Step C1: Attach exact confidence limits to sample D-017

Software
Purpose

Report the EPG of D-017 with an exact confidence interval instead of a single number.

Action

Run epg with the raw count, the counting variant and the built-in profile of the egg type (--species; --matrix pig for pig faeces). The first line of the output is the nominal EPG with its exact interval; the other lines are read in step C2.

Command
mcmaster-epg epg 6 --variant whole_chamber --species toxocara_canis
In the web app

Browser application → One sample (#epg) → Eggs counted → Counting factor: Counting variant, Area read: whole chamber (factor 15) → Egg loss and dispersion: Built-in parasite and faeces, Parasite: Toxocara canis, Faeces: dog → Calculate.

Expected result

The output, which P1 shows in its step 18:

Output of example E02
$ mcmaster-epg epg 6 --variant whole_chamber --species toxocara_canis
EPG 90 (95% CI 33.0 to 195.9)
Corrected EPG 276 (95% CI 80 to 1249), factor 46 (published factor)
  interval includes between-sample dispersion k = 4.4
LOD50 25 EPG (14 to 37), LOD95 154 EPG (111 to 240); published LOD 25 EPG

The first line repeats the nominal EPG of P1 and adds its exact (Garwood) 95% interval: the nominal EPG values, mean count × factor, that are compatible with the observed count under Poisson counting error. An interval constructed in this way contains the true value in at least 95% of examinations. It is wide and asymmetric because the count is small: a few eggs are compatible with a severalfold range of means.

Note

The nominal interval covers counting error only: it neither corrects for egg loss nor includes the variation between preparations. Without --species the command prints this line alone (nominal method).

Open in the app: Open the One sample form

Step C2: Read every number of the output

Software
Purpose

Understand what each value of the output states and how far it can be trusted.

Action

Read lines 2 to 4 of the output of step C1, then the full record with --json.

Corrected EPG (line 2): the count multiplied by the corrected factor. For the whole chamber of a built-in combination this is the published empirical factor (correction_source: published factor; 46 (T. canis), 28 (Trichuris spp.), 21 (A. suum)); for the other variants it is the nominal factor divided by the recovery of the count model (count model). The interval is obtained by exact inversion of the negative binomial distribution.

Dispersion (line 3): the interval of the corrected EPG includes the between-sample dispersion k of the profile, estimated from the spiked samples of the reference study. It does not include the uncertainty of the recovery or of k.

Limits of detection (line 4): LOD50 and LOD95 of the profile with their intervals, and the published LOD of Table 4 of Kochanowski et al. (2013), which is a different quantity (GL3).

JSON record: total_count, readings and cf_total are the raw count, the number of readings and the factor for the summed count (total_count × cf_total = epg_nominal). quantitative_range is the range of spiking levels on which the published whole-chamber regression was fitted, and within_quantitative_range states whether the corrected EPG lies in it. lod95_extrapolated marks an LOD95 above the highest spiking level.

Command
mcmaster-epg epg 6 --variant whole_chamber --species toxocara_canis --json
In the web app

Browser application → One sample (#epg) → Advanced options → Print the full result as JSON → Calculate → Download JSON.

Expected result

The JSON record of sample D-017:

Output of example E04 43 lines
$ mcmaster-epg epg 6 --variant whole_chamber --species toxocara_canis --json
{
  "profile": "toxocara_canis, dog, whole chamber (Kochanowski et al. 2013)",
  "variant": "whole_chamber",
  "species": "toxocara_canis",
  "matrix": "dog",
  "total_count": 6,
  "readings": 1,
  "positive": true,
  "factor_nominal": 15.0,
  "cf_total": 15.0,
  "epg_nominal": 90.0,
  "epg_nominal_ci": [
    33.02841380236277,
    195.89211033778028
  ],
  "conf": 0.95,
  "factor_corrected": 46.0,
  "correction_source": "published factor",
  "dispersion_k": 4.364355807022221,
  "epg_corrected": 276.0,
  "epg_corrected_ci": [
    79.88608403898716,
    1248.7298316344466
  ],
  "quantitative_range": [
    150,
    300
  ],
  "within_quantitative_range": true,
  "published_lod": 25,
  "lod50": 25.112448262575686,
  "lod50_ci": [
    14.222337904654978,
    37.24993786644834
  ],
  "lod95": 154.1815022450933,
  "lod95_ci": [
    110.99225350994526,
    240.04530524958327
  ],
  "lod95_extrapolated": false
}

For D-017 the corrected EPG lies within the range on which the published regression was fitted (within_quantitative_range is true), and LOD95 is not extrapolated. Figure 4 draws the nominal and the corrected interval with LOD50 and LOD95.

Note

The published whole-chamber factors are 1/slope of regressions with a positive intercept; as plain multipliers they overestimate, most at low counts. Outside the quantitative range the factor is applied beyond the levels on which it was estimated.

Result for one sample Interval plot on a logarithmic EPG axis comparing the nominal and the corrected EPG of one sample, with markers for LOD50 and LOD95. 20 50 100 200 500 1000 2000 EPG (log scale) LOD50 25 EPG LOD95 154 EPG Nominal EPG count 6 × factor 15; exact Poisson 95% CI 90 33.0 195.9 Corrected EPG published factor 46; 95% CI includes k = 4.4 276 80 1249 Result for one sample Interval plot on a logarithmic EPG axis comparing the nominal and the corrected EPG of one sample, with markers for LOD50 and LOD95. 20 50 100 200 500 1000 2000 EPG (log scale) LOD50 25 EPG LOD95 154 EPG Nominal EPG count 6 × factor 15; exact Poisson 95% CI 90 33.0 195.9 Corrected EPG published factor 46; 95% CI includes k = 4.4 276 80 1249
Figure 4. Result for one sample. A whole-chamber count of 6 Toxocara canis eggs in dog faeces (example E04): the nominal EPG with its exact Poisson interval and the corrected EPG with its negative binomial interval, which is scaled by the corrected factor and includes the dispersion k between preparations but not the uncertainty of the egg-loss correction, on a logarithmic axis; LOD50 and LOD95 of the profile are marked. SVG file

Open in the app: Open the One sample form

Step C3: Combine replicate readings

Software
Purpose

Pool independent readings of one sample and test whether they agree within counting error.

Action

Give all counts of the sample, separated by spaces; they are pooled, and with two or more readings the index of dispersion is printed [6]. The first example uses three readings of independently prepared portions of one sample (step A3); its numbers are illustrative and are not data of P1.

Command
mcmaster-epg epg 6 4 9 --variant whole_chamber --species toxocara_canis
mcmaster-epg epg 0 0 0 40 --variant one_grid
In the web app

Browser application → One sample (#epg) → Eggs counted: several numbers separated by spaces or commas → Calculate.

Expected result

Three readings that agree (illustrative values, not data of P1):

Output of example E23
$ mcmaster-epg epg 6 4 9 --variant whole_chamber --species toxocara_canis
EPG 95 (95% CI 57.2 to 148.4), mean of 3 readings
Index of dispersion 1.00 (p = 0.368): compatible with counting error
Corrected EPG 291 (95% CI 146 to 640), factor 46 (published factor)
  interval includes between-sample dispersion k = 4.4
LOD50 25 EPG (14 to 37), LOD95 154 EPG (111 to 240); published LOD 25 EPG

The pooled nominal and corrected EPG have narrower intervals than the single reading of step C1, because more eggs were counted in total, and the index of dispersion is compatible with counting error. Readings that disagree strongly:

Output of example E03
$ mcmaster-epg epg 0 0 0 40 --variant one_grid
EPG 1000 (95% CI 714.4 to 1361.7), mean of 4 readings
Index of dispersion 40.00 (p = 7.72e-26): readings vary more than counting error; the interval is too narrow

Here the readings vary far more than counting error explains, and the output states that the interval is too narrow.

Note

A small p means that the readings vary more than counting error explains and that the Poisson interval is too narrow. Analyse with a profile that includes k (step C2), and check that the replicates were independent preparations made in the same way (step A3).

Step C4: Interpret a result near the limit of detection

Software
Purpose

Avoid over-reading low counts and negative results.

Action

Compare the result with the fitted LOD50 and LOD95 of the profile (step D1) and report the interval, not the point estimate alone. Report a negative reading as no eggs seen, together with the LOD95 of the profile: the EPG that would be detected in 95% of single examinations.

In the web app

Browser application → One sample (#epg) → result card: interval plot with the LOD50 and LOD95 markers (Fig. 4).

Expected result

A report of the form EPG E (95% CI L to U); LOD50 A, LOD95 B EPG, or no eggs seen; LOD95 B EPG, with the profile named; E, L, U, A and B stand for the printed values.

Note

A negative count is not proof of absence: a sample at the LOD95 is still negative in one examination in twenty, and below LOD50 most examinations are negative. P1 (step 19) reports a zero count with the published whole-chamber LOD of Table 4 of Kochanowski et al. (2013), 25 EPG for T. canis and 15 EPG for Trichuris spp. and A. suum: the lowest spiking level at which eggs were found in at least half of the replicates of that level. For a built-in profile, the LOD50 and LOD95 of this step come from a detection curve fitted to the share of positive samples at all spiking levels of the same study (GL3): LOD50 states on a continuous scale what the published LOD reads off the grid of levels, and LOD95 adds the EPG detected in 95% of single examinations. The output of step C1 prints both, and the two need not be equal.

Step C5: Analyse many samples

Software
Purpose

Analyse a series of samples in one run, with the same rules as epg.

Action

Prepare a CSV file with the columns sample_id,counts and, optionally, variant,species,matrix; separate replicate readings of one sample by ;. Give the method either in the file (per row) or on the command line (for all rows), never both. Redirect the output to keep it (> results.csv).

Command
mcmaster-epg batch docs/protocol/data/samples_example.csv
In the web app

Browser application → Batch (CSV) (#batch) → Samples (CSV file): choose a file, or Load example file → Counting factor: None: use the variant column of the file → Calculate → Download results.csv.

Expected result

One CSV row per sample with every field of epg --json:

Output of example E18
$ mcmaster-epg batch docs/protocol/data/samples_example.csv
sample_id,profile,variant,species,matrix,total_count,readings,positive,factor_nominal,cf_total,epg_nominal,epg_nominal_ci_low,epg_nominal_ci_high,conf,factor_corrected,correction_source,dispersion_k,epg_corrected,epg_corrected_ci_low,epg_corrected_ci_high,quantitative_range_low,quantitative_range_high,within_quantitative_range,published_lod,lod50,lod50_ci_low,lod50_ci_high,lod95,lod95_ci_low,lod95_ci_high,lod95_extrapolated,dispersion_index,dispersion_p
dog-01,"toxocara_canis, dog, whole chamber (Kochanowski et al. 2013)",whole_chamber,toxocara_canis,dog,6,1,True,15.0,15.0,90.0,33.02841380236277,195.89211033778028,0.95,46.0,published factor,4.364355807022221,276.0,79.88608403898716,1248.7298316344466,150,300,True,25,25.112448262575686,14.222337904654978,37.24993786644834,154.1815022450933,110.99225350994526,240.04530524958327,False,,
dog-02,"trichuris, dog, two grids (Kochanowski et al. 2013)",two_grids,trichuris,dog,2,1,True,50.0,50.0,100.0,12.110463927198255,361.234383386198,0.95,62.125527529317864,count model,17.77401747530537,124.25105505863573,14.739090021440607,519.9348704404135,,,,50,31.335767761173667,16.16020805249618,47.98039198950105,277.28448999383625,186.8854443210084,539.2424761740358,False,,
dog-03,"ascaris_suum, dog, one grid (Kochanowski et al. 2013)",one_grid,ascaris_suum,dog,1,2,True,100.0,50.0,50.0,1.265890399214495,278.5821695469449,0.95,101.43247670871659,count model,3.9953990006049844,50.716238354358296,1.2860602661385303,378.41366309397563,,,,100,61.88001770529737,35.8431973343764,90.38128316534808,651.3280436719803,376.5298673558508,2008.494516407949,True,1.0,0.31731050786291115
dog-04,"trichuris, dog, flotation slide (Kochanowski et al. 2013)",flotation_slide,trichuris,dog,4,1,True,7.0,7.0,28.0,7.6290576153842755,71.69112072782586,0.95,65.0782692204168,count model,3.558137348427048,260.3130768816672,57.63915604953793,1528.519656517657,,,,100,31.13447847792822,15.263357415237145,48.36580009069223,303.7013751543238,198.22625285566906,650.2796775415887,True,,
pig-01,"ascaris_suum, pig, whole chamber (Kochanowski et al. 2013)",whole_chamber,ascaris_suum,pig,12,1,True,15.0,15.0,180.0,93.00862663083329,314.4237757226544,0.95,21.0,published factor,,252.0,130.2120772831666,440.19328601171617,50,300,True,15,13.549542452787964,6.246185705411684,18.55772930375857,37.80874683066046,27.384649209044166,68.29074668630314,False,,
pig-02,"nominal, two grids",two_grids,,,3,1,True,50.0,50.0,150.0,30.933606144780075,438.36365348711615,0.95,,,,,,,,,,,,,,,,,,,

The row without a species uses the nominal method, so its corrected columns are empty; the row with two readings carries the index of dispersion.

Note

The example file is synthetic (docs/protocol/data/README.md). If the file has a variant column, do not add method options on the command line (Troubleshooting, T04).

Open in the app: Open the Batch form

DDetection limits and replicate planning

Limits of detection state what a negative result can exclude; replicate planning states how much work a given precision requires.

Step D1: Determine LOD50 and LOD95

Software
Purpose

State the smallest EPG that the procedure detects in half and in 95% of single examinations.

Action

Run lod with the counting variant and the profile; --probability selects the level (0.5 unless given). Compare the counting variants for the same egg type and faeces.

Command
mcmaster-epg lod --variant one_grid --probability 0.95
mcmaster-epg lod --variant whole_chamber --species toxocara_canis
mcmaster-epg lod --variant one_grid --species ascaris_suum --matrix pig --probability 0.5
mcmaster-epg lod --variant one_grid --species ascaris_suum --matrix pig --probability 0.95
mcmaster-epg lod --variant two_grids --species ascaris_suum --matrix pig --probability 0.5
mcmaster-epg lod --variant two_grids --species ascaris_suum --matrix pig --probability 0.95
mcmaster-epg lod --variant whole_chamber --species ascaris_suum --matrix pig --probability 0.5
mcmaster-epg lod --variant whole_chamber --species ascaris_suum --matrix pig --probability 0.95
mcmaster-epg lod --variant flotation_slide --species ascaris_suum --matrix pig --probability 0.5
mcmaster-epg lod --variant flotation_slide --species ascaris_suum --matrix pig --probability 0.95
In the web app

Browser application → Detection limit (#lod) → Counting factor → Egg loss and dispersion → Probability of detection → Draw the detection curve → Calculate.

Expected result

Without a profile, the Poisson limit of the nominal method:

Output of example E06
$ mcmaster-epg lod --variant one_grid --probability 0.95
299.6 EPG detected with probability 0.95

With a built-in profile, the limit from the detection curve fitted to the spiked samples, with its interval and the published LOD:

Output of example E07
$ mcmaster-epg lod --variant whole_chamber --species toxocara_canis
25.1 EPG detected with probability 0.5 (95% CI 14.2 to 37.2), curve fitted to spiked samples; published LOD 25 EPG

The four counting variants for Ascaris suum in pig faeces, at probabilities 0.5 and 0.95 (Fig. 5):

Output of example E08h
$ mcmaster-epg lod --variant one_grid --species ascaris_suum --matrix pig --probability 0.5
50.4 EPG detected with probability 0.5 (95% CI 31.9 to 70.3), curve fitted to spiked samples; published LOD 50 EPG
$ mcmaster-epg lod --variant one_grid --species ascaris_suum --matrix pig --probability 0.95
319.6 EPG detected with probability 0.95 (95% CI 226.8 to 557.3) (extrapolated), curve fitted to spiked samples; published LOD 50 EPG
Output of example E08i
$ mcmaster-epg lod --variant two_grids --species ascaris_suum --matrix pig --probability 0.5
18.0 EPG detected with probability 0.5 (95% CI 6.7 to 31.7), curve fitted to spiked samples; published LOD 25 EPG
$ mcmaster-epg lod --variant two_grids --species ascaris_suum --matrix pig --probability 0.95
233.8 EPG detected with probability 0.95 (95% CI 152.3 to 483.8), curve fitted to spiked samples; published LOD 25 EPG
Output of example E08j
$ mcmaster-epg lod --variant whole_chamber --species ascaris_suum --matrix pig --probability 0.5
13.5 EPG detected with probability 0.5 (95% CI 6.2 to 18.6), curve fitted to spiked samples; published LOD 15 EPG
$ mcmaster-epg lod --variant whole_chamber --species ascaris_suum --matrix pig --probability 0.95
37.8 EPG detected with probability 0.95 (95% CI 27.4 to 68.3), curve fitted to spiked samples; published LOD 15 EPG
Output of example E08k
$ mcmaster-epg lod --variant flotation_slide --species ascaris_suum --matrix pig --probability 0.5
25.7 EPG detected with probability 0.5 (95% CI 15.2 to 37.0), curve fitted to spiked samples; published LOD 25 EPG
$ mcmaster-epg lod --variant flotation_slide --species ascaris_suum --matrix pig --probability 0.95
133.8 EPG detected with probability 0.95 (95% CI 96.2 to 205.8), curve fitted to spiked samples; published LOD 25 EPG

The limits fall as the volume read grows, from one grid to the whole chamber. The LOD95 of one grid lies above the highest spiking level and is marked "(extrapolated)".

Note

The Poisson limit assumes no egg loss and is lower than the observed one. Built-in profiles take the limits from the detection curve fitted to the share of positive spiked samples; calibrated profiles from the count model fitted to the raw counts; entered parameters from the count model with the entered recovery and k. Limits above 300 eggs/g are extrapolations.

Probability of detection Rising detection curve against EPG on a logarithmic axis, with LOD50 and LOD95 markers for one grid, two grids, whole chamber and flotation slide. 0.1 0.2 0.5 1 2 5 10 20 50 100 200 500 EPG (log scale) 0 0.25 0.5 0.75 1 Probability of detection whole chamber: estimate and 95% CI LOD50 and LOD95, one grid LOD50 and LOD95, two grids LOD50 and LOD95, whole chamber LOD50 and LOD95, flotation slide open symbol: extrapolated value LOD50 13.5 LOD95 37.8 Probability of detection Rising detection curve against EPG on a logarithmic axis, with LOD50 and LOD95 markers for one grid, two grids, whole chamber and flotation slide. 0.1 1 10 100 EPG (log scale) 0.25 0.5 0.75 1 Probability of detection whole chamber: estimate and 95% CI LOD50 and LOD95, one grid LOD50 and LOD95, two grids LOD50 and LOD95, whole chamber LOD50 and LOD95, flotation slide open symbol: extrapolated value LOD50 13.5 LOD95 37.8
Figure 5. Probability of detection. Probability that a single whole-chamber examination finds at least one egg of Ascaris suum in pig faeces, against the true EPG on a logarithmic axis, from the built-in profile (examples E08a to E08g). Markers show LOD50 and LOD95 of the four counting variants (examples E08h to E08k). SVG file

Open in the app: Open the Detection limit form

Step D2: Plan replicates for a target precision

Software
Purpose

Determine how many independent preparations give the coefficient of variation (CV) you need at the expected EPG.

Action

Give the expected EPG, the counting variant, the target CV and the profile.

Command
mcmaster-epg plan 150 --variant whole_chamber --cv 0.2 --species toxocara_canis
In the web app

Browser application → Replicates (#plan) → Expected EPG → Counting factor → Target coefficient of variation → Egg loss and dispersion → Calculate.

Expected result

The number of replicate counts, with the recovery and k of the count model used:

Output of example E09
$ mcmaster-epg plan 150 --variant whole_chamber --cv 0.2 --species toxocara_canis
13 replicate count(s) for CV 0.2 at 150 EPG (recovery 0.40, dispersion k 4.4, built-in)

The number follows from CV = sqrt((1/mean + 1/k) / n), with the mean count recovery × EPG / factor.

Note

The replicates are separate preparations (step A3). Without a profile the plan assumes Poisson counts and no egg loss, and then gives fewer replicates than needed when eggs are lost or preparations differ.

Open in the app: Open the Replicates form

ESequential reading protocol

Some laboratories read a sample in stages and stop at the first stage with eggs. The record of such a reading is a stage and a count. mcmaster-epg analyses the record with the functions of mcmaster_epg.protocol and with the Sequential reading form of the browser application; there is no command-line subcommand.

Step E1: Read in stages and record the stage

Software
Purpose

Use the larger volumes only for samples that are negative on the grids, and keep the record that the analysis needs.

Action

Read the two grids. If they hold eggs, record stage 1 and the count. If not, read the whole chamber of the same filling; if it holds eggs, record stage 2 and the count. If not, read a flotation slide prepared from the suspension as in P1; record stage 3 and the count, or negative if it holds no eggs (Fig. 6).

In the web app

Browser application → Sequential reading (#sequential).

Expected result

One record per sample: stage 1, 2 or 3 with its count, or negative.

Note

The stored value count × factor does not replace the record; keep the stage and the count (step A2). The stages need not be the Raynaud variants: other variant names or method profiles can be passed to SequentialProtocol.

Sequential reading protocol Flow chart of the three reading stages, two grids, whole chamber and flotation slide, with example records and their EPG intervals. Stage 1 Read the two grids factor 50 eggs seen? yes Stop. Record stage 1 and the count no Stage 2 Read the whole chamber factor 15 eggs seen? yes Stop. Record stage 2 and the count no Stage 3 Read a flotation slide factor 7 eggs seen? yes Stop. Record stage 3 and the count no Negative. Record stage 0 Examples: EPG and exact interval from the record (A. suum, pig faeces) 3 eggs on the grids EPG 149 (95% CI 19.9 to 637.6); stored as 150 grids empty, 5 eggs in the chamber EPG 101 (95% CI 9.4 to 396.2); stored as 75 grids empty, 12 eggs in the chamber EPG 243 (95% CI 48.6 to 746.3); stored as 180 no eggs at any stage EPG 0.0 (95% CI 0.0 to 70.8) Why the zeros count The interval uses the zeros of the earlier stages, so it is not biased by the stopping rule. The grids see a share p of the eggs of the same chamber filling; p = 0.4088 for A. suum in pig faeces (built-in profiles). Sequential reading protocol Flow chart of the three reading stages, two grids, whole chamber and flotation slide, with example records and their EPG intervals. Stage 1 Read the two grids factor 50 eggs seen? yes Stop. Record stage 1 and the count 3 eggs on the grids EPG 149 (95% CI 19.9 to 637.6); stored as 150 no Stage 2 Read the whole chamber factor 15 eggs seen? yes Stop. Record stage 2 and the count grids empty, 5 eggs in the chamber EPG 101 (95% CI 9.4 to 396.2); stored as 75 grids empty, 12 eggs in the chamber EPG 243 (95% CI 48.6 to 746.3); stored as 180 no Stage 3 Read a flotation slide factor 7 eggs seen? yes Stop. Record stage 3 and the count no Negative. Record stage 0 no eggs at any stage EPG 0.0 (95% CI 0.0 to 70.8) Why the zeros count The interval uses the zeros of the earlier stages, so it is not biased by the stopping rule. The grids see a share p of the eggs of the same chamber filling; p = 0.4088 for A. suum in pig faeces (built-in profiles).
Figure 6. Sequential reading protocol. The two grids are read first (stage 1); if they hold no eggs, the whole chamber of the same filling (stage 2); if it holds none, a flotation slide (stage 3). The EPG and its exact interval are computed from the record (stage, count) and use the zeros of the earlier stages. The example boxes show records of example E19, analysed with the built-in profiles of Ascaris suum in pig faeces. SVG file

Open in the app: Open the Sequential reading form

Step E2: Estimate EPG and its exact interval from the record

Software
Purpose

Estimate the EPG from the record without the bias of the stopping rule.

Action

Build the protocol from the profiles of your egg type and faeces, SequentialProtocol(species=..., matrix=...), and call sequential_epg(stage, count, protocol); stage 0 or "negative" stands for no eggs. The estimate uses the zeros of the earlier stages.

Command
python docs/protocol/tools/sequential_example.py
In the web app

Browser application → Sequential reading (#sequential) → What to compute: EPG from a record → Parasite: Ascaris suum, Faeces: pig → Stage at which the reading stopped → Eggs counted at that stage → Confidence level → Calculate.

Expected result

For the built-in profiles of Ascaris suum in pig faeces the session prints p and the three factors, then four records with the estimate, the interval and the stored value count × factor, followed by the quantities used in steps E3 and E4:

Output of example E19 35 lines
$ python docs/protocol/tools/sequential_example.py
>>> from mcmaster_epg import (SequentialProtocol, sequential_epg, protocol_lod,
...                           protocol_detection, stage_detection, stage_probabilities,
...                           recorded_epg_bias, reconstruct_record, check_record)
>>> pig = SequentialProtocol(species="ascaris_suum", matrix="pig")
>>> pig.p, pig.factors
(0.4087740166577692, (50.0, 15.0, 7.0))
>>> r = sequential_epg(1, 3, pig)
>>> round(r.epg), round(r.ci_low, 1), round(r.ci_high, 1), r.recorded_epg
(149, 19.9, 637.6, 150.0)
>>> r = sequential_epg("whole_chamber", 5, pig)
>>> round(r.epg), round(r.ci_low, 1), round(r.ci_high, 1), r.recorded_epg
(101, 9.4, 396.2, 75.0)
>>> r = sequential_epg(2, 12, pig)
>>> round(r.epg), round(r.ci_low, 1), round(r.ci_high, 1), r.recorded_epg
(243, 48.6, 746.3, 180.0)
>>> r = sequential_epg(0, 0, pig)
>>> round(r.epg, 1), round(r.ci_low, 1), round(r.ci_high, 1)
(0.0, 0.0, 70.8)
>>> {k: round(v[0], 1) for k, v in protocol_lod(pig).items()}
{'lod50': 9.3, 'lod95': 40.8}
>>> round(protocol_detection(25, pig), 3), round(stage_detection(25, pig)["two_grids"], 3)
(0.843, 0.383)
>>> {k: round(float(v), 3) for k, v in stage_probabilities(25, pig).items()}
{'stage_1': 0.396, 'stage_2': 0.313, 'stage_3': 0.135, 'negative': 0.157}
>>> recorded_epg_bias([10, 25, 50, 100], pig).round(2)
array([0.48, 0.32, 0.18, 0.07])
>>> b = reconstruct_record(150, pig)
>>> b.stage, b.count, round(b.weight, 3)
(1, 3, 0.997)
>>> check_record(1160, pig).flags
('not_a_multiple',)
>>> c = check_record(180, pig)
>>> c.flags, round(c.best.p_grids_zero, 4)
(('implausible',), 0.0018)

The estimate differs from the stored value because it uses the zeros of the earlier stages and corrects for egg loss through the profiles. The lower limit of a stage-2 record rises with its count.

Warning

The coverage of the interval holds over all records of the protocol together, not for each stage: a record of a stage that is rare at the true EPG can be missed more often than conf. The estimate is biased upwards at low EPG; near the limit of detection read the interval, not the estimate alone.

Open in the app: Open the Sequential reading form

Step E3: Describe the detection of the whole protocol

Software
Purpose

Know how often the protocol finds eggs, and at which stage.

Action

protocol_lod(protocol) gives LOD50 and LOD95 of the whole protocol; protocol_detection(epg, protocol) the probability that any stage finds eggs; stage_detection(epg, protocol) that of each stage read alone; stage_probabilities(epg, protocol) the share of samples that stop at each stage.

In the web app

Browser application → Sequential reading → What to compute: Detection limits of the protocol, or Detection at a given EPG → True EPG values → Calculate.

Expected result

In the output of step E2, protocol_lod gives the LOD50 and LOD95 of the protocol, and the pair printed after protocol_detection compares the whole protocol with the two grids read alone at 25 EPG: the protocol detects eggs in a much larger share of samples. The stage probabilities at the same EPG sum to one with the negative share. Figure 7 shows these shares over the range of EPG.

Note

The limits of detection of the protocol use the count model, not a detection curve fitted to the protocol; the grids are part of the chamber and do not enter them.

Detection by the sequential protocol Stacked shares of the three stages and of negative results against EPG, with a line for detection by the two grids alone. 0% 25% 50% 75% 100% Share of samples 2 5 10 15 25 40 60 100 150 200 400 800 True EPG (A. suum, pig faeces; categories, not to scale) 25 EPG: protocol 0.843 grids alone 0.383 stage 1, two grids stage 2, whole chamber stage 3, flotation slide negative at all stages two grids alone Detection by the sequential protocol Stacked shares of the three stages and of negative results against EPG, with a line for detection by the two grids alone. 0% 25% 50% 75% 100% Share of samples 2 5 10 15 25 40 60 100 150 200 400 800 True EPG (A. suum, pig faeces) categories, not to scale 25 EPG: protocol 0.843 grids alone 0.383 stage 1, two grids stage 2, whole chamber stage 3, flotation slide negative at all stages two grids alone
Figure 7. Detection by the sequential protocol. Share of samples that stop at stage 1 (two grids), stage 2 (whole chamber) or stage 3 (flotation slide), or remain negative, against the true EPG, for the built-in profiles of Ascaris suum in pig faeces (example E22). The line shows detection by the two grids read alone. SVG file

Step E4: Assess stored values: bias and record checks

Software
Purpose

Evaluate legacy data stored as count × factor and screen them for recording errors.

Action

recorded_epg_bias(epg_values, protocol) gives the relative bias of the stored value; reconstruct_record(value, protocol) the most likely stage and count behind it, with its weight; check_record(value, protocol) flags values that are no multiple of any factor (not_a_multiple), that disagree with the stage, or that are implausible (implausible), for example many eggs in the chamber while the grids were empty, to which the model gives the probability (1 − p)count.

In the web app

Browser application → Sequential reading → What to compute: Check a stored value (count × factor) → Stored value → Stage at which the reading stopped (or unknown) → Calculate.

Expected result

In the output of step E2 the relative bias of the stored value is positive and shrinks as the EPG rises. reconstruct_record(150, pig) returns the most likely stage and count with a weight close to one; check_record(1160, pig) returns not_a_multiple; and check_record(180, pig), twelve eggs in the chamber with empty grids, returns implausible together with the probability that all twelve eggs lay outside the grids.

Note

A flag means a recording error or a different method. It is a screening threshold, not a test with a controlled error rate.

Step E5: State p and test its influence

Software
Purpose

Make the assumption about the share p explicit and see how much a conclusion depends on it.

Action

By default p is derived from the profiles as factor ratio × recovery ratio: 0.4088 (A. suum, pig faeces), 0.3 (nominal profiles). If the grids hold a different share of the chamber's eggs in your laboratory, give it explicitly, for example SequentialProtocol(species="ascaris_suum", matrix="pig", p=0.3), and repeat the analysis at both ends of a plausible range of p.

In the web app

Browser application → Sequential reading → Advanced options → Share of the chamber's eggs on the grids (leave empty to derive it from the profiles).

Expected result

The same record analysed at two or more values of p. A conclusion that changes between them depends on p and should be reported with that caveat.

Note

The package does not estimate p from data. Recommended values and ranges of p for each built-in combination, estimated from the 2013 data and the literature, are given in the package README (Validation) and in validation/PROTOCOL_P_REPORT.md. A p that differs from the true share lowers the coverage of the interval.

FHerds

Steps F1 to F5 estimate herd-level quantities from one count per animal and plan the number of animals to examine.

Step F1: Prepare one count per animal

Software
Purpose

Provide data that meet the assumptions of the herd analysis.

Action

Examine each animal once, independently of the others, with one procedure and one method profile. Keep the negative animals: every herd quantity is computed from all animals examined. Enter the counts on the command line, or give a text file or a CSV column counts with --file.

In the web app

Browser application → Herd (#herd) → Eggs counted, one value per animal (or the field Or a file of counts).

Expected result

A list of non-negative integers, one per animal, zeros included.

Note

The example file docs/protocol/data/animals_example.csv holds the counts of the herd example below; it is synthetic.

Open in the app: Open the Herd form

Step F2: Run the herd analysis

Software
Purpose

Estimate the apparent prevalence, the mean EPG and the share of animals at or above treatment thresholds.

Action

Give the counts, the method and one or more thresholds with --threshold. The gamma-model intervals of small herds are calibrated by a parametric bootstrap (200 bootstrap herds below 60 animals); --seed and --n-boot control it, and --json prints the full record.

Command
mcmaster-epg herd 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 4 5 6 7 8 11 18 22 --variant whole_chamber --species ascaris_suum --matrix pig --threshold 50 150
mcmaster-epg herd --file docs/protocol/data/animals_example.csv --variant whole_chamber --species ascaris_suum --matrix pig --threshold 50 150
In the web app

Browser application → Herd (#herd) → Fill in example, or enter the counts → Counting factor → Egg loss and dispersion → EPG thresholds → Calculate (up to about a minute).

Expected result

Four blocks: positives and apparent prevalence; mean EPG; limits without assumptions; the gamma aggregation model.

Output of example E15
$ mcmaster-epg herd 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 4 5 6 7 8 11 18 22 --variant whole_chamber --species ascaris_suum --matrix pig --threshold 50 150
30 animals, 10 positive (33.3%, 95% CI 17.3% to 52.8%)
Mean EPG 57 (95% CI 19 to 274), factor 20.3; aggregation between animals k 0.14
Without assumptions about the distribution of EPG among animals:
  infected (any eggs): at least 17.3%; McMaster counts give no upper limit
  true EPG >= 50: 1.6% to 67.3% of animals (95% CI; detection at 50 EPG 0.92)
  true EPG >= 150: 0.0% to 59.9% of animals (95% CI; detection at 150 EPG 1.00)
Gamma aggregation model (negative binomial between animals; intervals calibrated by a parametric bootstrap, 200 herds):
  infected 35.4% (17.1% to 100.0%); mean EPG of infected 160, shape 1.59
  true EPG >= 50: 29.3% (12.8% to 51.2%)
  true EPG >= 150: 15.1% (4.1% to 35.5%)

The form with --file reads the same counts from the example file and prints identical output (example E15b).

Note

The bootstrap lengthens the run; for a given seed the result is reproducible.

Open in the app: Open the Herd form

Step F3: Read the herd output

Software
Purpose

Interpret each block of the output together with its assumptions.

Action

Read the four blocks of the output of step F2 in order.

Positives. The number and share of positive animals, with an exact binomial interval.

Mean EPG. Corrected for egg loss (mean count × factor / recovery), with a negative binomial profile-likelihood interval, the corrected factor and the aggregation k between animals.

Limits without assumptions about the distribution of EPG among animals: a lower limit for infection and, for each threshold, the range of the share of animals at or above it, with the detection at the threshold. These limits hold for every distribution and are therefore wide.

Gamma aggregation model. Estimates and intervals of the same quantities, narrower but valid only as far as the model holds.

In the web app

Browser application → Herd → Show tables → Calculate; the result card draws the ranges and the model intervals (Fig. 8).

Expected result

The limits without assumptions are wide because one McMaster count cannot place an animal near the threshold on one side of it. The gamma-model intervals lie inside them when the model fits. Without assumptions infection has no upper limit, and under the model its interval often extends to all animals (step F4).

Note

Report both: the limits without assumptions state what the counts alone establish; the model adds precision only as far as it holds.

Herd result Chart of herd results: apparent prevalence, mean EPG, and for two EPG thresholds the wide ranges without assumptions beside the narrower gamma-model intervals. A Share of animals range without assumptions about the EPG distribution (95%) estimate and 95% interval (exact binomial, or gamma aggregation model) 0% 25% 50% 75% 100% Animals (%) Positive animals apparent prevalence, exact 95% CI 33.3% 17.3% 52.8% Infected (any eggs) without assumptions: at least 17.3% no upper limit gamma model 35.4% 17.1% 100.0% True EPG ≥ 50 without assumptions 1.6% 67.3% gamma model 29.3% 12.8% 51.2% True EPG ≥ 150 without assumptions 0.0% 59.9% gamma model 15.1% 4.1% 35.5% B Mean EPG of the herd, corrected for egg loss 10 20 50 100 200 500 EPG (log scale) Mean EPG factor 20.3, 95% CI 57 19 274 Herd result Chart of herd results: apparent prevalence, mean EPG, and for two EPG thresholds the wide ranges without assumptions beside the narrower gamma-model intervals. A Animals range without assumptions about the EPG distribution (95%) estimate and 95% interval (exact binomial, or gamma aggregation model) 0% 25% 50% 75% 100% Animals (%) Positive animals apparent prevalence, exact 95% CI 33.3% 17.3% 52.8% Infected (any eggs) without assumptions: at least 17.3% no upper limit gamma model 35.4% 17.1% 100.0% True EPG ≥ 50 without assumptions 1.6% 67.3% gamma model 29.3% 12.8% 51.2% True EPG ≥ 150 without assumptions 0.0% 59.9% gamma model 15.1% 4.1% 35.5% B Mean EPG of the herd 10 20 50 100 200 500 EPG (log scale) 57 19 274
Figure 8. Herd result. A synthetic herd of thirty animals, one whole-chamber count each, analysed with the built-in profile of Ascaris suum in pig faeces (example E16): apparent prevalence and mean EPG with their intervals, and the share of animals at or above 50 and 150 EPG, as limits without assumptions (ranges) and under the gamma aggregation model (estimates with intervals). SVG file

Step F4: Check the model and the warnings

Software
Purpose

Recognise when a result rests on an assumption that the data do not support.

Action

Read every warning line. A WARNING from the goodness-of-fit test means that the counts do not fit the gamma model: rely on the limits without assumptions. A line beginning Nominal method means that no profile was given: the limits for thresholds are too narrow and the mean EPG too low. An upper limit of 100% for prevalence is expected: negative results never exclude that all animals are infected.

Command
mcmaster-epg herd 0 0 1 5 12 --variant whole_chamber
Expected result

Without a profile the output ends with the nominal-method warning:

Output of example E21
$ mcmaster-epg herd 0 0 1 5 12 --variant whole_chamber
5 animals, 3 positive (60.0%, 95% CI 14.7% to 94.7%)
Mean EPG 54 (95% CI 13 to 706), factor 15.0; aggregation between animals k 0.42
Without assumptions about the distribution of EPG among animals:
  infected (any eggs): at least 14.7%; McMaster counts give no upper limit
Gamma aggregation model (negative binomial between animals; intervals calibrated by a parametric bootstrap, 200 herds):
  infected 76.8% (22.5% to 100.0%); mean EPG of infected 70, shape 0.78
Nominal method (no egg loss, Poisson): give --species, --profile or --recovery; otherwise the limits for thresholds are too narrow and the mean EPG too low
Note

The model check detects strongly bimodal herds but not every departure from the gamma distribution; compare the model with the limits without assumptions.

Step F5: Determine the survey size

Software
Purpose

Determine how many animals to examine so that at least one positive is found when a given share of the herd is at or above a given EPG.

Action

Give the share of animals to detect (--prevalence), the EPG threshold and the profile.

Command
mcmaster-epg survey --variant whole_chamber --species toxocara_canis --prevalence 0.1 --threshold 50
mcmaster-epg survey --profile lab.json --prevalence 0.1 --threshold 200
In the web app

Browser application → Survey size (#survey) → Counting factor → Egg loss and dispersion → Prevalence to detect → EPG threshold → Calculate.

Expected result

The number of animals and the lowest detection at the threshold within the parameter ranges, for a built-in profile:

Output of example E17
$ mcmaster-epg survey --variant whole_chamber --species toxocara_canis --prevalence 0.1 --threshold 50
48 animals: a positive is found with probability 0.95 if at least 10% of the herd has 50 EPG or more (detection at 50 EPG at least 0.62)

and for the calibrated profile of step B3:

Output of example E14
$ mcmaster-epg survey --profile lab.json --prevalence 0.1 --threshold 200
42 animals: a positive is found with probability 0.95 if at least 10% of the herd has 200 EPG or more (detection at 200 EPG at least 0.69)
Note

No distribution of EPG among the animals is assumed. The number is n = ln(1 − conf) / ln(1 − fraction × s1(t)), with s1(t) the probability that an animal at the threshold gives a positive count, taken at the least favourable end of the 95% parameter range.

Open in the app: Open the Survey size form

GReporting and citing

Report results so that they can be recomputed, reused and cited.

Step G1: Export the results

Software
Purpose

Keep complete, machine-readable results and pass them to other tools.

Action

Add --json to epg and herd; batch prints CSV; calibrate --report writes a Markdown report. In the browser use Download TXT, Download JSON, Download results.csv, Download profile (JSON), Download report (Markdown) and Printable report (print or save as PDF from the browser). For faecal egg count reduction tests and hierarchical models pass total_count and cf_total, the raw count and correction factor of the WAAVP 2023 guideline [12], to eggCounts (rawCounts = TRUE, preCF), bayescount or fecrt.com; eggCounts needs an integer factor.

In the web app

Browser application → any result card → Copy, Download TXT, Download JSON or Printable report.

Expected result

Files that reproduce the reported result: the JSON record (step C2), the CSV of batch, the calibration report and the printable report. In the JSON record total_count × cf_total equals epg_nominal.

Note

The printable report holds the inputs, the equivalent command, the result, the program output, the versions of mcmaster-epg, Pyodide and Python, the date and time and the citation. Nothing of it is stored by the page.

Step G2: Record what is needed to reproduce the result

Software
Purpose

Allow the result to be recomputed exactly.

Action

Record the package version (python -c "import mcmaster_epg; print(mcmaster_epg.__version__)"), the profile (the built-in combination, or the profile file itself), the exact command line or form inputs, the confidence level and, for herd, the seed and the number of bootstrap herds (--seed, --n-boot). Report, as P1 does, the raw count and the counting variant with the result.

In the web app

Browser application → any result card → Printable report (inputs, equivalent command and versions).

Expected result

A record from which another analyst obtains identical output.

Note

The examples of this protocol were run with the versions stated at its beginning; their outputs are stored with their commands in docs/protocol/outputs/, and every stated value is listed with its source in Table 8.

Step G3: Cite the laboratory protocol, the software, the method and this protocol

Software
Purpose

Give credit and make the analysis traceable from the bench to the reported value.

Action

Cite the laboratory protocol P1 [1], the software [2], the method paper [5] and this protocol.

Software. Kochanowski M, Dąbrowska J. mcmaster-epg, version 1.1.1. Zenodo; 2026. https://doi.org/10.5281/zenodo.24662026 (concept DOI; resolves to the latest version).

Method. Kochanowski M, Dąbrowska J, Karamon J, Cencek T, Osiński Z. Analysis of the accuracy and precision of the McMaster method in detection of the eggs of Toxocara and Trichuris species (Nematoda) in dog faeces. Folia Parasitologica 2013; 60(3): 264–272. https://doi.org/10.14411/fp.2013.030

This protocol. Kochanowski M, Dąbrowska J. Statistical analysis of McMaster faecal egg counts with mcmaster-epg: exact confidence limits, correction for egg loss, detection limits and herd-level estimation, version 1.0. protocols.io; 2026. DOI [to be assigned on publication].

In the web app

Browser application → footer → How to cite.

Expected result

A methods section that names the laboratory protocol, the software version, the method profile and this protocol.

Note

The concept DOI of the software resolves to the latest version; state the version actually used (step G2).

6Anticipated results

A correct run with the versions stated at the beginning reproduces the captured outputs of this protocol (docs/protocol/outputs/), which were produced by the package itself. Read them as follows.

Single samples. For sample D-017 of P1 (E02, E04) the exact interval of the single count is wide and asymmetric: at small counts it spans a severalfold range that the point estimate hides. With the built-in profile the corrected EPG exceeds the nominal one by the ratio of the empirical to the nominal factor, and its interval is wider still, because it is scaled by the larger corrected factor and includes the dispersion k between preparations; it does not include the uncertainty of the egg-loss correction. LOD95 lies well above LOD50, reflecting the shallow detection curve of the spiked samples. Pooling three agreeing readings narrows both intervals (E23, illustrative); readings that disagree as strongly as in E03 are flagged by the index of dispersion.

Profiles. The built-in profiles (E10a to E10p) differ by counting variant and egg type: recovery is lowest for the flotation slide and, among the chamber variants, for Toxocara canis, and dispersion ranges from strong overdispersion to Poisson counts. The calibration example (E12, E12b) recovers the simulated recovery within its interval, detects overdispersion, and shows a slope of log mean count on log level close to 1; its count-model limits of detection are the ones used later (E13).

Sequential protocol. For the built-in Ascaris suum pig profiles (E19) the whole protocol detects eggs in a much larger share of samples than the two grids alone; stored values overstate low EPG on average; and a stored value that cannot arise from the protocol, or would be very unlikely, is flagged.

Herds. In the herd example (E15) the limits without assumptions for the share of animals at or above each threshold are wide, the gamma model gives narrower intervals inside them, and under the model the interval for infection extends to all animals. Without a profile (E21) the output warns that the nominal method was used.

The pattern of the built-in profiles is consistent with the observations of the reference study, in which eggs tended to accumulate in the central part of the chamber, in the grids; the tube variant gave the lowest numbers of Trichuris eggs; the detection of Toxocara eggs in the chamber was about half of that assumed by Raynaud, that of Ascaris close to Raynaud's assumptions [5].

Table 6. Anticipated results.
StepArtefactA correct resultExamples
A1 to A3Input tableOne row per reading: sample, variant or stage, egg type, faeces, replicate and raw count; no product count × factor alone.
A4Factor checkThe counting variant and the volumes give the same nominal EPG and interval; the Python library agrees.E01, E05, E20
B1Printed built-in profileFactor, recovery with its 95% range, k with its 95% range, LOD50 and LOD95 with intervals.E10o
B2Entered profile paper.jsonThe parameters as entered; corrected factor marked "entered recovery".E11
B3lab.json, lab.mdEstimates with profile-likelihood intervals; linearity, overdispersion and detection-curve checks; observed and predicted values agree at every level.E12, E12b
B4Result with --profileCorrected factor marked "calibrated recovery"; interval includes the calibrated k.E13
C1EPG of sample D-017Nominal EPG with an exact, asymmetric 95% interval, followed by the corrected EPG and the limits of detection.E02
C2Corrected EPG and JSON recordCorrected EPG above the nominal one, with a wider interval that includes k; LOD50 and LOD95 with intervals and the published LOD; within_quantitative_range and lod95_extrapolated in the record.E02, E04
C3Pooled replicate resultPooled EPG with narrower intervals; index of dispersion with its p-value and, when p is small, the statement that the interval is too narrow.E23, E03
C5results.csvOne row per sample with all fields of epg --json.E18
D1LOD50 and LOD95Poisson limit below the fitted one; limits falling from one grid to the whole chamber; extrapolated values marked.E06, E07, E08h to E08k
D2Number of replicatesAn integer number of independent preparations for the target CV.E09
E2 to E4Analysis of sequential recordsEstimate, interval and stored value per record; protocol LOD50 and LOD95; detection of protocol and grids; flags for impossible or implausible stored values.E19
F2 to F4Herd resultPositives with an exact interval; corrected mean EPG; ranges without assumptions; gamma-model estimates; warnings where they apply.E15, E21
F5Survey sizeAn integer number of animals and the detection at the threshold.E17, E14
G1, G2Exported files and reproducibility recordJSON record, CSV, report and versions sufficient to recompute the result.E04, E18, E12b

7Troubleshooting

Table 7. Troubleshooting: messages and their causes.
SymptomCauseFixExample
error: give --variant, --multiplier, --counted-ml or --profileNo counting factor was given.Give the counting variant, a multiplier or the volume read, or a profile file that contains its own factor.T01
error: give only one of --profile, --species or --recovery/--kTwo sources of egg loss and dispersion were given.Choose one: a profile file, a built-in combination, or entered parameters.T02
error: ... was not validated; validated: ascaris_suum in dog or pig, the others in dogThe combination of egg type and faeces is not part of the reference study, for example T. canis in pig faeces.Use a validated combination, enter published parameters (step B2) or calibrate the procedure (step B3).T03
batch stops with error: give --variant, ... although the file has a variant columnMethod options given on the command line apply to all rows and then need a factor on the command line too; they are not combined with the columns of the file.Give the method either in the file (columns variant, species, matrix) or on the command line for all rows (a factor with an optional profile), not both. If both are complete, batch stops with a message naming the line.T04
Index of dispersion ... readings vary more than counting error; the interval is too narrowReplicate readings differ more than Poisson counting error explains: between-preparation variation, or preparations made differently.Analyse with a profile that includes k (step C2); check the preparation of the replicates (step A3).E03
A WARNING line in the herd outputThe goodness-of-fit test rejects the gamma aggregation model, for example in a bimodal herd.Rely on the limits without assumptions; report the model results, if at all, with this caveat.
Nominal method (no egg loss, Poisson): give --species, --profile or --recovery ...The herd was analysed without a method profile.Give a built-in combination, a profile file or entered parameters; otherwise the limits for thresholds are too narrow and the mean EPG too low.E21
(extrapolated) after a limit of detection, or lod95_extrapolated: trueThe limit lies above the highest spiking level of the profile (300 eggs/g for the built-in profiles).Treat the value as an extrapolation; for a supported value calibrate with higher spiking levels (step B3).
Very wide intervalsSmall counts; low recovery (flotation slide, T. canis); small k; uncertain profile parameters; for herds, the limits without assumptions are wide by construction.Read a larger volume (whole chamber), prepare replicates (step D2), calibrate with more samples near the limit of detection (step B3), and for herds compare with the gamma model where it fits.
The upper limit of prevalence of infection is 100%An animal with a very low EPG is almost always negative, so negative counts never exclude infection of all animals.Expected behaviour. Report the lower limit and the shares of animals at or above meaningful thresholds.
The 95% interval of k from the example calibration does not contain the value used to simulate the fileA 95% interval misses its true value in about one study in twenty; this draw is such a case.None needed. The other intervals of the example contain their true values.
The browser application takes long to start, or herd and calibrate run for a long timeThe first visit downloads the Python runtime; the herd bootstrap and the calibration are computationally heavy (10 to 20 s at the first visit; up to a minute for the herd bootstrap or calibrate).Wait, or use Stop and rerun; later visits use the browser cache. For long series use the command line.
A form field rejects a number such as 0,95Form fields need a decimal point.Type 0.95. In CSV files of spiked samples a decimal comma is accepted, and comma, semicolon or tab may separate the columns.
The browser application does not start without an internet connectionThe page downloads the Python runtime from cdn.jsdelivr.net.Use the command line or the Python library offline; for a local copy of the runtime on a local host see web/README.md.

The messages of these examples, as printed:

Output of example T01, exit code 2
$ mcmaster-epg epg 3
usage: mcmaster-epg [-h]
                    {epg,lod,plan,herd,survey,batch,calibrate,profile} ...
mcmaster-epg: error: give --variant, --multiplier, --counted-ml or --profile
Output of example T02, exit code 2
$ mcmaster-epg epg 3 --variant two_grids --species toxocara_canis --recovery 0.5
usage: mcmaster-epg [-h]
                    {epg,lod,plan,herd,survey,batch,calibrate,profile} ...
mcmaster-epg: error: give only one of --profile, --species or --recovery/--k
Output of example T03, exit code 2
$ mcmaster-epg epg 3 --variant whole_chamber --species toxocara_canis --matrix pig
usage: mcmaster-epg [-h]
                    {epg,lod,plan,herd,survey,batch,calibrate,profile} ...
mcmaster-epg: error: toxocara_canis in pig faeces, whole_chamber, was not validated; validated: ascaris_suum in dog or pig, the others in dog
Output of example T04, exit code 2
$ mcmaster-epg batch docs/protocol/data/samples_example.csv --species ascaris_suum --matrix pig
usage: mcmaster-epg [-h]
                    {epg,lod,plan,herd,survey,batch,calibrate,profile} ...
mcmaster-epg: error: give --variant, --multiplier, --counted-ml or --profile

8References

  1. Kochanowski M, Dąbrowska J. Quantitative faecal egg count by the McMaster technique (Raynaud's modification). protocols.io. DOI: [to be inserted on publication].The laboratory protocol (P1) whose raw counts this protocol analyses.
  2. Kochanowski M, Dąbrowska J (2026). mcmaster-epg, version 1.1.1. Zenodo (concept DOI; resolves to the latest version). https://doi.org/10.5281/zenodo.24662026The software of this protocol.
  3. Gordon H, Whitlock H (1939). A new technique for counting nematode eggs in sheep faeces. J Sci Ind Res 12: 50–52. As given in the reference list of Kochanowski et al. (2013).The McMaster method.
  4. Raynaud JP (1970). Etude de l'efficacité d'une technique de coproscopie quantitative pour le diagnostic de routine et le controle des infestations parasitaires des bovins, ovins, equines et porcins. Ann Parasitol Hum Comp 45: 321–342. Title as given in the reference list of Kochanowski et al. (2013), which abbreviates the journal as Ann. Parasitol. (Paris).Origin of the modification and of the nominal factors.
  5. Kochanowski M, Dąbrowska J, Karamon J, Cencek T, Osiński Z (2013). Analysis of the accuracy and precision of the McMaster method in detection of the eggs of Toxocara and Trichuris species (Nematoda) in dog faeces. Folia Parasitologica 60(3): 264–272. https://doi.org/10.14411/fp.2013.030Laboratory procedure, spiking design and the data behind the built-in profiles.
  6. Torgerson PR, Paul M, Lewis FI (2012). The contribution of simple random sampling to observed variations in faecal egg counts. Vet Parasitol 188(3–4): 397–401. https://doi.org/10.1016/j.vetpar.2012.03.043Index-of-dispersion test for replicate readings.
  7. Wilrich C, Wilrich PT (2009). Estimation of the POD function and the LOD of a qualitative microbiological measurement method. J AOAC Int 92(6): 1763–1772. https://doi.org/10.1093/jaoac/92.6.1763Complementary log-log detection model; slope 1 of the detection curve.
  8. Fülleborn F (1921). Über die Wanderung von Ascaris und Nematodenlarven im Körper und intrauterine Ascarisinfektion. Arch Schiffs- u Tropenhyg 25: 146–149. As given in the reference list of Kochanowski et al. (2013).Double flotation used to confirm that the faeces of the reference study were free of eggs.
  9. Amadesi A, Bosco A, Rinaldi L, Cringoli G, Claerebout E, Maurelli MP (2020). Cattle gastrointestinal nematode egg-spiked faecal samples: high recovery rates using the Mini-FLOTAC technique. Parasit Vectors 13: 230. https://doi.org/10.1186/s13071-020-04107-0Literature data on the share p of eggs on the grids.
  10. Bosco A, Maurelli MP, Ianniello D, Morgoglione ME, Amadesi A, Coles GC, Cringoli G, Rinaldi L (2018). The recovery of added nematode eggs from horse and sheep faeces by three methods. BMC Vet Res 14: 7. https://doi.org/10.1186/s12917-017-1326-7Literature data on the share p of eggs on the grids.
  11. Grandi G, Vadlejch J, Höglund J (2025). Comparative evaluation of an AI-based counting system (OvaCyte™) and the McMaster counting method for quantification of strongyle eggs in sheep faeces. Vet Parasitol 338: 110533. https://doi.org/10.1016/j.vetpar.2025.110533Literature study examined for p (grids only).
  12. Kaplan RM, et al. (2023). World Association for the Advancement of Veterinary Parasitology (W.A.A.V.P.) guideline for diagnosing anthelmintic resistance using the faecal egg count reduction test in ruminants, horses and swine. Vet Parasitol 318: 109936. https://doi.org/10.1016/j.vetpar.2023.109936Raw count and correction factor passed to reduction tests.

9Keywords

McMaster; faecal egg count; eggs per gram; limit of detection; veterinary parasitology; prevalence; partial identification; method validation; calibration; sequential reading; herd survey; egg loss; companion protocol; statistical analysis

10Changelog of the protocol

Version 1.0 (2026-11-30), for mcmaster-epg 1.1.1

First version, written for mcmaster-epg 1.1.1.

AppendixSources of the stated values

Every laboratory or numeric value stated in the text, with the file or publication it is taken from. Program output is captured, not typed: docs/protocol/outputs/MANIFEST.json.

Table 8. Register of stated values.
Value statedValueSource
Faeces per sample2 gfactors.py docstring and FAECES_G; data.py docstring; README introduction
Flotation solution per sample28 mlfactors.py docstring and FLOTATION_ML; data.py docstring; README introduction
Flotation solutionsaturated magnesium sulphate solution (MgSO4)data.py docstring; Kochanowski et al. 2013, Folia Parasitologica 60: 264-272, Materials and Methods (p. 265)
Volume of the suspension30 mlfactors.geometric_factor docstring
Suspension per gram of faeces15 ml per gramfactors.geometric_factor docstring
Nominal factors (one grid, two grids, whole chamber, flotation slide)100, 50, 15, 7RAYNAUD_FACTORS and data.RAYNAUD_MULTIPLIER (Raynaud 1970 via Kochanowski et al. 2013); README
Engraved grid of one cell10 mm × 10 mmfactors.py docstring; Kochanowski et al. 2013, Materials and Methods (p. 265)
Volume of the whole chamber1.5 mlfactors.py CHAMBER_ML and docstring; README, Whole-chamber factor
Volume read implied, one grid0.15 mlNOMINAL_COUNTED_ML
Volume read implied, two grids0.30 mlNOMINAL_COUNTED_ML
Volume read implied, whole chamber1.0 mlNOMINAL_COUNTED_ML; README, Whole-chamber factor
Published whole-chamber factors46 (T. canis), 28 (Trichuris spp.), 21 (A. suum)EMPIRICAL_WHOLE_CHAMBER_FACTORS; README, Output
Nominal factor, one grid100RAYNAUD_FACTORS
Nominal factor, two grids50RAYNAUD_FACTORS
Nominal factor, whole chamber15RAYNAUD_FACTORS
Nominal factor, flotation slide7RAYNAUD_FACTORS
Geometric factor of the whole chamber10factors.py, comment on NOMINAL_COUNTED_ML (1.5 ml chamber: geometric factor 10); README, Whole-chamber factor
Underestimation by the nominal slide factorabout five- to nine-foldREADME, Flotation slide
Effective factor of the flotation slide38 to 65README, Flotation slide
Spiking levels of the reference study15, 25, 50, 100, 150, 200, 250, 300 eggs/g; 20 replicatesdata.py comments (Table 4 of the paper)
Bootstrap of the herd intervals200 bootstrap herds below 60 animalsREADME, Herds; CHANGELOG
Highest spiking level of the built-in profiles300 eggs/gREADME, Limits
Confidence levels stored for the sequential protocol0.90, 0.95, 0.975 (sequential_epg); 0.95, 0.975, 0.9875 (protocol_lod)README, Sequential reading protocol, Limits
Validation: published tables reproduced16 of 16README, Validation; validation/REPORT.md
Validation: detection curve not rejected16 of 16README, Validation; validation/REPORT.md
Dispersion k found for Toxocara canis4.4README, Validation (dispersion found for Toxocara canis)
Validation: mean coverage of the Poisson interval74%README, Validation; validation/REPORT.md, section 6
Validation: coverage of the calibration intervals94.4% to 98.0%README, Validation (eight levels of 20 samples); validation/CALIBRATION_REPORT.md
Validation: coverage of the herd limits without assumptions99.7%README, Validation; validation/HERD_REPORT.md
Validation: exact coverage of the sequential interval0.954README, Sequential reading protocol, Validation of the intervals; validation/PROTOCOL_REPORT.md
Share p estimated from published spiking studies0.3072 to 0.3240README, Validation (share p); validation/PROTOCOL_P_REPORT.md
Lowest Python version3.10pyproject.toml
Lowest NumPy version1.22pyproject.toml
Lowest SciPy version1.8pyproject.toml
Run times of the browser application10 to 20 s at the first visit; up to a minute for the herd bootstrap or calibrateREADME, Run in the browser
Precision of the recovery by calibration design8 levels × 20 samples: recovery about ±12%; 5 levels × 10 samples: about ±21%README, Your own method
Simulated calibration example60 samples, 6 levels from 25 to 800 eggs/g, 10 each, factor 50, true recovery 0.6, k = 6examples/README.md
Published whole-chamber LOD (P1, step 19)25 EPG for T. canis and 15 EPG for Trichuris spp. and A. suumdata.LIMIT_OF_DETECTION of the package; Table 4 of Kochanowski et al. (2013); P1, step 19
Share p of the chamber's eggs on the grids, derived0.4088 (A. suum, pig faeces), 0.3 (nominal profiles)README, Sequential reading protocol and Validation
Observations of the reference studyeggs tended to accumulate in the central part of the chamber, in the grids; the tube variant gave the lowest numbers of Trichuris eggs; the detection of Toxocara eggs in the chamber was about half of that assumed by Raynaud, that of Ascaris close to Raynaud's assumptionsKochanowski et al. 2013, Discussion