Mathematics & Statistics for Dairy Science

Dairy Science & Technology · Foundations · also Engineering Mathematics, Statistical Methods, Biostatistics

10units
10chapters
8,050words
102practice questions

The calculus, differential equations and statistics that dairy engineering problems, kinetics and quality control need.

In the exams: Supports numerical items across ICAR AICE subject 38 (Dairy Engineering) and GATE XL-U Section 4; statistics recurs in ASRB NET dairy disciplines and in quality-control units

Syllabus

  1. Matrices and linear equations
  2. Differential and integral calculus
  3. Ordinary differential equations: first-order kinetics and cooling
  4. Numerical methods for engineering problems
  5. Descriptive statistics and probability distributions
  6. Sampling theory and confidence intervals
  7. Tests of significance: t, chi-square and F
  8. Correlation and regression
  9. Analysis of variance and basic experimental designs
  10. Introduction to response surface methodology for product optimisation

Study manual

Mathematics and statistics are the working language of a dairy plant. A technologist who standardises milk solves a pair of linear equations; one who sizes a holding tube integrates a velocity profile; one who predicts how fast a tanker of milk warms or how fast spores die in a retort solves a first-order differential equation; and one who decides whether a new starter culture really gives firmer yoghurt runs a test of significance on panel scores. The same tools appear in quality control charts, in calibrating a mid-infrared milk analyser against reference fat tests, and in optimising an ice cream formula with a response surface design.

This manual teaches the mathematics and statistics that dairy science degrees around the world place in the first year, with every method worked through a dairy problem. It covers matrices and systems of linear equations, differential and integral calculus, first-order differential equations for kinetics and cooling, numerical methods for problems that have no neat closed-form answer, descriptive statistics and probability distributions, sampling and confidence intervals, the t, chi-square and F tests, correlation and regression, analysis of variance with the basic experimental designs, and an introduction to response surface methodology. Later subjects build on it: dairy engineering uses the calculus and differential equations; quality assurance uses the distributions and control-chart logic; research methods extends the experimental designs.

Examinations use this material in two ways. Postgraduate entrance and doctoral fellowship examinations in dairy engineering and food technology set numerical items in which the mathematics is the hidden step: a log reduction, a cooling time, a mass balance. Research-service and quality-control examinations ask statistics directly: which test suits which data, how to read an analysis of variance table, what a correlation coefficient does and does not show. The manual shows the working in full so that each step can be practised by hand and then checked with a spreadsheet or a short script.

1. Matrices and systems of linear equations

Matrices, determinants and inverses

A matrix is a rectangular array of numbers arranged in rows and columns; an m by n matrix has m rows and n columns. Matrices of the same size are added element by element. Two matrices A and B can be multiplied only when the number of columns of A equals the number of rows of B, and each element of the product is the sum of the products of a row of A with a column of B. Matrix multiplication is not commutative: AB is in general different from BA. The identity matrix I has ones on the leading diagonal and zeros elsewhere, and AI = IA = A.

The determinant is a single number calculated from a square matrix. For a 2 by 2 matrix with rows (a, b) and (c, d) it is ad − bc. For a 3 by 3 matrix it is found by expanding along any row or column, multiplying each element by its cofactor (the signed determinant of the 2 by 2 matrix left when that element's row and column are removed). A square matrix whose determinant is zero is called singular; it has no inverse, and a system of equations built on it has either no solution or infinitely many.

The inverse of a non-singular square matrix A, written A⁻¹, satisfies AA⁻¹ = I. For a 2 by 2 matrix the inverse is the matrix with rows (d, −b) and (−c, a), divided by the determinant ad − bc. Larger inverses are found by the adjoint method (transpose of the cofactor matrix divided by the determinant) or, in practice, by row reduction. The transpose of a matrix, written Aᵀ, swaps rows and columns; it appears constantly in regression, where the least-squares coefficients are found from (XᵀX)⁻¹XᵀY.

Solving linear systems: Cramer's rule and elimination

A system of n linear equations in n unknowns can be written AX = B, where A holds the coefficients, X the unknowns and B the constants. If A is non-singular the unique solution is X = A⁻¹B. Cramer's rule gives each unknown as a ratio of determinants: the unknown xᵢ equals the determinant of A with its i-th column replaced by B, divided by the determinant of A. Cramer's rule is convenient by hand for two or three unknowns and becomes laborious beyond that.

Gaussian elimination is the general method. Row operations (swapping two rows, multiplying a row by a non-zero number, adding a multiple of one row to another) reduce the augmented matrix [A | B] to an upper triangular form, and the unknowns are then found by back-substitution. Gauss–Jordan elimination continues until the coefficient part becomes the identity matrix, so the solution can be read off directly. The rank of a matrix, the number of linearly independent rows, decides consistency: a system has a solution only if the rank of A equals the rank of the augmented matrix, and the solution is unique only if that rank equals the number of unknowns.

Iterative methods such as Jacobi and Gauss–Seidel start from a guess and refine it repeatedly. They converge reliably when the coefficient matrix is diagonally dominant, meaning each diagonal element is larger in magnitude than the sum of the others in its row. They are used for large sparse systems, for example the node equations of a finite-difference model of heat conduction through a cheese block or a cold-store wall.

Linear equations in dairy work

Standardisation of milk is the commonest dairy use of simultaneous equations. Suppose a plant must make 1,000 kg of milk at 3.0% fat by mixing whole milk at 4.5% fat with skim milk at 0.05% fat. Let W be the mass of whole milk and S the mass of skim milk. The mass balance is W + S = 1,000 and the fat balance is 0.045W + 0.0005S = 30. Solving gives W ≈ 662.9 kg and S ≈ 337.1 kg. The Pearson square gives the same answer graphically: the parts of each component are the differences between the target and the other component's fat content, here 2.95 parts whole milk to 1.5 parts skim milk.

When two constraints must be met at once, such as fat and solids-not-fat in a recombined milk, or fat, milk solids-not-fat and sugar in an ice cream mix, the problem becomes three or four equations in as many unknowns. Each ingredient contributes known fractions of each component; the unknowns are the ingredient masses; and the right-hand side holds the target masses of fat, solids-not-fat, sugar and total mix. The system is solved by elimination or matrix inversion, and a negative answer means the target cannot be reached with those ingredients.

Linear systems also arise in calibration. Mid-infrared milk analysers measure absorbance at several wavelengths, and the fat, protein and lactose contents are each estimated from a linear combination of these absorbances with intercorrection terms. Finding the calibration coefficients from reference samples is a least-squares matrix problem of the kind treated in the regression chapter.

Remember

2. Differential and integral calculus

Limits, derivatives and rates of change

Calculus deals with quantities that change continuously. The derivative of a function y = f(x), written dy/dx, is the limit of the ratio of the change in y to the change in x as the change in x tends to zero. It is the slope of the tangent to the curve and the instantaneous rate of change: the rate at which temperature rises in a heated product, the rate at which acidity develops during fermentation, or the rate at which a bacterial count grows.

The standard rules give most derivatives quickly. The derivative of xⁿ is nxⁿ⁻¹; of eˣ it is eˣ; of eᵏˣ it is keᵏˣ; of ln x it is 1/x; of sin x it is cos x; and of cos x it is −sin x. The product rule states that the derivative of uv is u dv/dx + v du/dx. The quotient rule states that the derivative of u/v is (v du/dx − u dv/dx)/v². The chain rule states that if y depends on u and u depends on x, dy/dx = (dy/du)(du/dx). Partial derivatives extend the idea to functions of several variables: the partial derivative of f(x, y) with respect to x treats y as a constant. Partial derivatives appear in the heat-conduction equation, in error propagation and in the first-order conditions of response surface models.

A second derivative, d²y/dx², measures how the slope itself changes. It indicates whether a curve is concave upward or downward and is the basis of the test for maxima and minima.

Maxima, minima and optimisation

At a maximum or minimum of a smooth function the first derivative is zero. If the second derivative there is negative the point is a maximum; if positive, a minimum; if zero, the test is inconclusive. This simple rule solves many design questions. For example, the cost of insulating a pipe rises with insulation thickness while the cost of lost heat falls; the total cost has a minimum at the thickness where the derivative of total cost is zero, the economic thickness of insulation.

For a function of two variables, such as the predicted firmness of a cheese as a function of renneting temperature and calcium chloride dose, a stationary point is found by setting both partial derivatives to zero and solving the two equations simultaneously. Whether that point is a maximum, a minimum or a saddle point is decided by the second partial derivatives: with D = f_xx f_yy − (f_xy)², the point is a maximum if D > 0 and f_xx < 0, a minimum if D > 0 and f_xx > 0, and a saddle if D < 0. Response surface methodology uses exactly this analysis on a fitted quadratic model.

Optimisation with constraints, such as finding the cheapest ice cream mix that still meets minimum fat and protein standards, is a linear programming problem when the cost and constraints are linear. It is solved by the simplex method or by software; the graphical method suffices for two variables and shows that the optimum lies at a corner of the feasible region.

Integration and its uses

Integration reverses differentiation. The indefinite integral of xⁿ is xⁿ⁺¹/(n + 1) plus a constant, for n not equal to −1; the integral of 1/x is ln|x|; and the integral of eᵏˣ is eᵏˣ/k. Integration by substitution and integration by parts (the integral of u dv equals uv minus the integral of v du) handle more complicated forms.

The definite integral of f(x) between a and b is the area under the curve between those limits, and it accumulates a rate into a total. In a dairy plant the total heat removed from milk in a cooler is the integral of the heat-flow rate over time; the volume of milk flowing through a pipe per second is the integral of the local velocity over the pipe cross-section; and the lethality of a heat treatment, the F value, is the integral over time of the lethal rate 10 raised to the power (T − T_ref)/z. For laminar flow of a Newtonian liquid in a round pipe the velocity profile is a parabola, and integrating it shows that the mean velocity is exactly half the centreline velocity. That result explains why holding tubes are sized on the fastest particle, at twice the mean velocity in laminar flow, rather than on the average.

The mean value of a function over an interval is the definite integral divided by the length of the interval. Average temperature over a cooling period, average flow over a shift and average concentration in a fermenter all use this definition.

Remember

3. First-order differential equations: kinetics and cooling

Separable equations and first-order kinetics

A differential equation relates a function to its derivatives. A first-order ordinary differential equation contains only the first derivative, and many are separable: they can be rearranged so that all terms in y are on one side and all terms in x or t on the other, and then integrated.

First-order kinetics is the most important example in dairy science. When the rate of a change is proportional to the amount remaining, dN/dt = −kN, where k is the rate constant. Separating and integrating gives ln(N/N₀) = −kt, or N = N₀e^(−kt). The same equation describes the death of bacteria and spores during heating, the inactivation of enzymes such as alkaline phosphatase, the loss of thiamine or vitamin C during storage, and the denaturation of many whey proteins under fixed conditions. The half-life, the time for the quantity to fall to half, is ln 2/k, about 0.693/k, and does not depend on the starting amount.

Microbiologists use base-10 logarithms. The decimal reduction time D is the time at a stated temperature for the count to fall tenfold, so log₁₀(N₀/N) = t/D and D = 2.303/k. If a spore population has D₁₂₁ = 0.2 min, a process of 2.4 min at 121 °C gives 12 decimal reductions. Growth follows the same equation with a positive sign, dN/dt = μN, so during exponential growth the generation time is ln 2/μ. A zero-order reaction, by contrast, proceeds at a constant rate, dC/dt = −k, so the amount falls linearly; some colour and browning changes are often modelled this way.

Newton's law of cooling

Newton's law of cooling states that the rate at which a body's temperature changes is proportional to the difference between its temperature and that of its surroundings: dT/dt = −k(T − Tₐ), where Tₐ is the ambient or coolant temperature. Setting θ = T − Tₐ gives dθ/dt = −kθ, the same first-order equation, so θ = θ₀e^(−kt). The temperature difference falls exponentially, quickly at first and then ever more slowly.

The law applies when the body is well mixed or small enough that its temperature is uniform, the lumped-capacity condition, which holds when the Biot number (hL/k_solid) is below about 0.1. Milk stirred in a bulk tank, a can of milk in a water bath and a thin pouch in an ice-water bath fit it reasonably well; a large block of butter or cheese does not, because its centre lags its surface. For a lumped body the constant k equals hA/(mc_p), where h is the surface heat-transfer coefficient, A the area, m the mass and c_p the specific heat. Faster stirring raises h and so k.

A worked case: milk at 35 °C is placed in a tank with coolant effectively at 2 °C, and after 1 hour it is at 20 °C. Then θ₀ = 33 and θ = 18 after 1 h, so k = ln(33/18) ≈ 0.606 per hour. The time to reach 4 °C (θ = 2) is ln(33/2)/0.606 ≈ 4.6 h. A result of that kind shows at once that the cooling system is too slow for the common target of reaching 4 °C within a few hours of milking.

Linear first-order equations and mixing problems

A linear first-order equation has the form dy/dx + P(x)y = Q(x). It is solved by multiplying both sides by the integrating factor e^(∫P dx), which turns the left side into the derivative of the product of y and the integrating factor; integration then gives the solution. Many process problems fit this form.

Mixing problems are a classic dairy application. A balance tank holds V litres of milk containing a dissolved cleaning-agent residue at concentration C. Fresh milk flows in and out at the same rate q. The residue mass changes as d(VC)/dt = −qC, so C = C₀e^(−qt/V). The ratio V/q is the mean residence time; after three residence times about 5% of the original residue remains, and after five about 0.7%. The same model describes the flushing of a silo, the washing-out of an interface between product and water in a pipeline, and the dilution of a contaminant in a well-mixed vessel.

Second-order reactions, in which the rate depends on the square of concentration, give 1/C − 1/C₀ = kt. Some whey protein denaturation and certain Maillard steps have been modelled with orders other than one, and the order must be found from data by testing which plot (ln C, 1/C or C against time) is linear. The Arrhenius equation, k = A e^(−Eₐ/RT), links the rate constant to absolute temperature, so a plot of ln k against 1/T is a straight line of slope −Eₐ/R. The z value used in thermal processing is the temperature rise that cuts D tenfold; it plays the same role over the narrow range of processing temperatures.

Remember

4. Numerical methods for engineering problems

Roots of equations

Many engineering equations cannot be rearranged to give the unknown directly. The Colebrook equation for the friction factor in turbulent pipe flow, the equation for the outlet temperature of a heat exchanger with temperature-dependent properties, and the equation for the time a product takes to reach a given centre temperature are examples. Numerical root-finding solves them to any required accuracy.

The bisection method starts from two values of x at which the function f(x) has opposite signs, so a root lies between them. The interval is halved repeatedly, keeping the half in which the sign change occurs. Bisection is slow but certain: each step halves the error, so ten steps reduce it about a thousandfold. The Newton–Raphson method uses the slope: from a guess xₙ, the next estimate is xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ). Near a simple root it converges quadratically, roughly doubling the number of correct digits each step, but it can diverge from a poor starting value or where f′ is near zero. The secant method replaces the derivative by the slope through the two latest points and needs no derivative formula. Fixed-point iteration rewrites the equation as x = g(x) and repeats xₙ₊₁ = g(xₙ); it converges when the magnitude of g′(x) is below one near the root.

For example, to solve x³ − 2x − 5 = 0 by Newton–Raphson from x₀ = 2, f(2) = −1 and f′(2) = 10, so x₁ = 2.1; one more step gives about 2.0946, already close to the root.

Numerical integration and interpolation

When a function is known only at measured points, such as temperatures logged every minute during a batch pasteurisation, its integral must be estimated numerically. The trapezoidal rule joins neighbouring points with straight lines: for equal spacing h, the integral is h times (half the first value plus all the middle values plus half the last value). Simpson's one-third rule fits parabolas through successive groups of three points: the integral is h/3 times (first value plus 4 times each odd-numbered value plus 2 times each even-numbered interior value plus last value). It needs an even number of intervals and is exact for polynomials up to the third degree. Both are used to integrate lethal rates over a logged time-temperature profile to obtain the F value of an actual process.

Interpolation estimates a value between tabulated points. Linear interpolation between two entries of a steam table or a property table is the everyday case: if saturated steam pressure is tabulated at 120 and 125 °C, the value at 122 °C is taken 40% of the way between them. Lagrange and Newton divided-difference polynomials pass a curve through several points and give more accurate interpolation where the data curve strongly. Extrapolation beyond the data is far less reliable than interpolation within it.

Numerical differentiation estimates slopes from data. The central difference, (f(x + h) − f(x − h))/2h, is more accurate than the forward difference for the same spacing. It is used, for example, to estimate the rate of acid development from pH or titratable-acidity readings during a fermentation.

Numerical solution of differential equations

Most real process models are differential equations without a closed-form solution: microbial growth with a temperature that changes through the cold chain, heating of a product whose properties vary with temperature, or a fermenter where substrate, cells and acid interact. They are solved step by step.

Euler's method advances the solution of dy/dt = f(t, y) by yₙ₊₁ = yₙ + h f(tₙ, yₙ), using the slope at the start of each step. It is simple but its error is proportional to the step size, so small steps are needed. The modified Euler (Heun) method averages the slope at the start and at a predicted end point, and its error falls with the square of the step size. The fourth-order Runge–Kutta method combines four slope estimates per step, weighted 1, 2, 2 and 1, and its error is proportional to h⁴; it is the standard general-purpose method in engineering software.

Partial differential equations, such as transient heat conduction in a slab, ∂T/∂t = α ∂²T/∂x², are solved by finite differences: space and time are divided into a grid and the derivatives are replaced by differences between neighbouring grid values. The explicit scheme is stable only if the grid Fourier number αΔt/Δx² does not exceed one half; implicit schemes such as Crank–Nicolson are stable for any step. These methods underlie the commercial models used to design cold stores, cheese brining and the cooling of butter blocks.

Remember

5. Descriptive statistics and probability distributions

Measures of centre and spread

Statistics begins with describing data. The arithmetic mean is the sum of the values divided by their number. The median is the middle value when the data are ordered, and it is not pulled by a few extreme values, which makes it a better summary of skewed data such as bacterial counts or somatic cell counts. The mode is the most frequent value. In a symmetric distribution the three coincide; in a right-skewed distribution the mean exceeds the median.

The range is the difference between the largest and smallest values. The variance is the average squared deviation from the mean; for a sample it is the sum of squared deviations divided by n − 1, the degrees of freedom, which gives an unbiased estimate of the population variance. The standard deviation is the square root of the variance and has the same units as the data. The coefficient of variation is the standard deviation divided by the mean, expressed as a percentage; it allows the variability of, for example, fat content and milk yield to be compared despite their different units. The standard error of the mean is the standard deviation divided by the square root of n, and measures how precisely the mean is known rather than how variable individual values are.

Quartiles divide ordered data into four equal parts; the interquartile range, from the first to the third quartile, contains the middle half of the data. A box plot shows the median, quartiles and outliers and is a quick way to compare, say, fat tests from several collection routes. Skewness measures asymmetry and kurtosis measures the heaviness of the tails.

Probability and discrete distributions

Probability measures how likely an event is, on a scale from 0 to 1. For mutually exclusive events the probability that one or the other occurs is the sum of their probabilities. For independent events the probability that both occur is the product. The conditional probability of A given B is P(A and B)/P(B). Bayes' theorem reverses conditional probabilities and is the basis of interpreting screening tests: even a test with high sensitivity and specificity gives many false positives when the condition it detects is rare.

The binomial distribution gives the probability of x successes in n independent trials, each with the same probability p: P(x) = C(n, x)pˣ(1 − p)ⁿ⁻ˣ. Its mean is np and its variance np(1 − p). It describes, for example, the number of defective pouches in a sample of 20 when the defect rate is 2%, and it underlies attribute sampling plans. The Poisson distribution gives the probability of x events in a fixed interval when events occur independently at a mean rate λ: P(x) = e^(−λ)λˣ/x!. Its mean and variance are both λ. It describes colony counts on a plate, the number of spores per millilitre in a sample, and the number of contaminated packs in a large batch with a low contamination rate. The Poisson approximates the binomial when n is large and p is small, with λ = np.

The probability that a pack contains at least one organism when the mean number per pack is λ is 1 − e^(−λ). This simple result explains why low-level contamination in aseptically filled products shows up as an occasional spoiled pack rather than as uniform low counts.

Continuous distributions

The normal distribution is the symmetric bell-shaped curve defined by its mean μ and standard deviation σ. About 68.3% of values lie within one standard deviation of the mean, 95.4% within two, and 99.7% within three; exactly 95% lie within 1.96 standard deviations. Any normal variable is converted to the standard normal by z = (x − μ)/σ, and probabilities are read from z tables. If fill weights of a cup are normal with mean 102 g and standard deviation 1.5 g, the proportion below 100 g corresponds to z = −1.33, about 9%.

The central limit theorem states that the mean of a reasonably large random sample is approximately normally distributed whatever the shape of the parent distribution, with standard deviation σ/√n. It justifies normal-based confidence intervals for means and the limits of X-bar control charts.

Some dairy data are not normal. Bacterial and somatic cell counts are right-skewed and approximately log-normal: their logarithms are close to normal, which is why counts are averaged and compared on the log scale. The exponential distribution describes the time between independent random events. The t, chi-square and F distributions arise from sampling normal populations and are the basis of the significance tests in later chapters: the t distribution looks like the normal but has heavier tails for small samples; the chi-square distribution describes sums of squared standard normal variables and is used for variances and counts; and the F distribution is the ratio of two independent chi-square variables, each divided by its degrees of freedom, and compares variances.

Remember

6. Sampling theory and confidence intervals

Populations, samples and sampling methods

A population is the whole set about which a conclusion is wanted: all the milk in a silo, all the packs in a production lot, all the farmers supplying a plant. A sample is the part actually measured. A parameter, such as the true mean fat content of a lot, describes the population; a statistic, such as the mean fat of the packs tested, estimates it. The value of a sample depends entirely on how it is drawn.

In simple random sampling every unit has an equal chance of selection. Systematic sampling takes every k-th unit after a random start, such as every hundredth pack off a filler; it is practical but can be biased if the process has a cycle of the same period. Stratified sampling divides the population into groups that differ, such as collection routes or production shifts, and samples each; it gives a more precise estimate than simple random sampling of the same size when the strata really differ. Cluster sampling selects whole groups, such as all the cans from randomly chosen farms, and is cheaper but usually less precise. Sampling for analysis must also be physically representative: milk must be thoroughly mixed before a sample is taken, because fat rises quickly, and composite samples for payment testing must be proportional to the volumes delivered.

Sampling error is the difference between a statistic and the parameter that arises by chance and shrinks as the sample grows. Non-sampling errors, such as an unmixed tank, a biased method or a mislabelled sample, do not shrink with sample size and are often larger.

Sampling distributions and confidence intervals

If many samples of size n were taken, their means would form a sampling distribution centred on the population mean with standard deviation σ/√n, the standard error. A confidence interval uses this to give a range that, under repeated sampling, would contain the true parameter a stated proportion of the time.

When σ is known, or n is large, a 95% confidence interval for a mean is x̄ ± 1.96σ/√n. When σ is estimated by the sample standard deviation s from a small sample, the t distribution replaces z: x̄ ± t(α/2, n − 1)s/√n. For 10 samples, the two-sided 95% t value with 9 degrees of freedom is 2.262. Suppose 10 cheese blocks have mean moisture 37.2% and standard deviation 0.8%; the 95% interval is 37.2 ± 2.262 × 0.8/√10 = 37.2 ± 0.57, from 36.63 to 37.77%.

A confidence interval for a proportion uses p̂ ± z√(p̂(1 − p̂)/n) when n is large enough that np̂ and n(1 − p̂) both exceed about 5. If 18 of 300 farm samples fail an antibiotic screening test, p̂ = 0.06 and the 95% interval is 0.06 ± 1.96√(0.06 × 0.94/300) = 0.06 ± 0.027.

The correct interpretation matters in examinations: the 95% refers to the method, not to a probability that this particular interval contains the parameter. A wider interval comes from higher confidence, greater variability or a smaller sample; quadrupling n halves the width.

Sample size

Sample size is chosen before a study so that the estimate is precise enough or a difference of practical importance can be detected. For estimating a mean within a margin of error E with 95% confidence, n = (1.96σ/E)². If the standard deviation of fat content between farm deliveries is 0.4% and the plant wants the mean known within ±0.1%, n = (1.96 × 0.4/0.1)² ≈ 61.5, so 62 samples. For a proportion, n = 1.96² p(1 − p)/E², and when p is unknown the value 0.5 gives the largest, safest n: within ±5% that is 385.

For comparing two means, the sample size per group depends on the difference to be detected, the standard deviation, the significance level and the power, the probability of detecting the difference if it is real. A common approximation for 5% significance and 80% power is n per group ≈ 16σ²/Δ², where Δ is the difference. Detecting a difference of one standard deviation therefore needs about 16 per group, and half a standard deviation about 64.

Acceptance sampling of lots, treated fully in quality assurance, uses the same probability ideas. Its key lesson is that no feasible sample proves the absence of a low-level hazard: if 1% of packs are contaminated, 60 negative samples still leave a probability of about 0.55 that a contaminated lot would pass, since 0.99⁶⁰ ≈ 0.55. That is why food-safety systems rely on process control and not on end-product testing alone.

Remember

7. Tests of significance: t, chi-square and F

The logic of hypothesis testing

A test of significance asks whether an observed difference is larger than chance alone would readily produce. The null hypothesis, H₀, states no effect: the new starter gives the same mean firmness as the old, or the mean fat of a lot equals the declared value. The alternative hypothesis, H₁, states that there is an effect, in one direction (one-tailed) or either direction (two-tailed). A test statistic is calculated from the data and compared with its distribution under H₀.

The p-value is the probability, if H₀ were true, of obtaining a result at least as extreme as that observed. If it is below the chosen significance level α, conventionally 0.05, H₀ is rejected. A Type I error is rejecting a true null hypothesis, and its probability is α. A Type II error is failing to reject a false null hypothesis, with probability β; the power of the test is 1 − β. Lowering α makes Type I errors rarer but Type II errors more common unless the sample is enlarged.

Statistical significance is not practical importance. With thousands of samples a difference of 0.01% fat can be significant yet irrelevant; with five samples a commercially important difference can fail to reach significance. Good reporting gives the size of the effect and its confidence interval alongside the p-value. Every test also rests on assumptions, such as independence, normality and equal variances, which should be checked before the result is trusted.

t-tests

The one-sample t-test compares a sample mean with a stated value: t = (x̄ − μ₀)/(s/√n), with n − 1 degrees of freedom. A dairy checks whether its 500 ml packs meet a declared fat content of 3.0% by testing 12 packs; if their mean is 2.92% with standard deviation 0.10%, t = (2.92 − 3.00)/(0.10/√12) = −2.77, which exceeds in magnitude the two-sided 5% critical value of 2.201 for 11 degrees of freedom, so the shortfall is significant.

The independent two-sample t-test compares the means of two separate groups, such as yoghurt firmness with two different cultures. With the pooled-variance version, which assumes equal variances, the standard error of the difference is s_p√(1/n₁ + 1/n₂), where s_p² is the weighted average of the two sample variances, and the degrees of freedom are n₁ + n₂ − 2. Welch's version does not assume equal variances and adjusts the degrees of freedom.

The paired t-test is used when each observation in one set is matched to one in the other: the same milk samples analysed by two methods, or the same panellists scoring two cheeses. The differences within pairs are analysed as a single sample, t = d̄/(s_d/√n). Pairing removes the variation between samples and is much more sensitive than treating the data as independent, which is a common examination trap. When data are clearly non-normal and samples are small, rank-based alternatives such as the Mann–Whitney and Wilcoxon signed-rank tests are used.

Chi-square and F tests

The chi-square test compares observed counts with the counts expected under a hypothesis: χ² = Σ(O − E)²/E. In a goodness-of-fit test the expected counts come from a stated distribution, and the degrees of freedom are the number of categories minus one, minus one more for each parameter estimated from the data. In a test of independence on a contingency table with r rows and c columns, the expected count in each cell is the row total times the column total divided by the grand total, and the degrees of freedom are (r − 1)(c − 1). For example, a plant can test whether the proportion of milk samples failing a residue screen is independent of the collection route. Expected counts should generally be at least 5; for a 2 by 2 table with small counts, Yates' continuity correction or Fisher's exact test is used.

In sensory evaluation the chi-square test, or the equivalent binomial calculation, decides whether a triangle test result shows a perceptible difference: under H₀ the probability of a correct choice is one third.

The F test compares two variances: F = s₁²/s₂², with the larger variance conventionally placed on top, and degrees of freedom n₁ − 1 and n₂ − 1. It answers questions such as whether a new fat analyser is less variable than the old one. Its main use, however, is in analysis of variance, where the F ratio compares the variance between treatment means with the variance within treatments. The F test is sensitive to non-normality, so for comparing the spread of skewed data Levene's test is often preferred.

Remember

8. Correlation and regression

Correlation

Correlation measures the strength of the linear association between two variables. Pearson's correlation coefficient r is the covariance of x and y divided by the product of their standard deviations; it lies between −1 and +1. A value near +1 means that y rises almost linearly with x; near −1, that y falls; and near 0, that there is no linear relation. A strong curved relation can still give r close to zero, so a scatter plot should always be drawn first.

Correlation does not prove causation. The somatic cell count of a herd's milk may correlate with the summer months, but both may be driven by heat stress and changes in management. A third variable, chance, or reverse causation can produce a correlation. The significance of r for n pairs is tested with t = r√(n − 2)/√(1 − r²) on n − 2 degrees of freedom: with 20 pairs, r = 0.45 is significant at 5%, while with 6 pairs even r = 0.75 is not.

Spearman's rank correlation applies the same idea to ranks and is used for ordinal data, such as panel rankings, or for monotonic but non-linear relations. The coefficient of determination, r², is the proportion of the variation in y accounted for by the linear relation with x; r = 0.9 means that 81% of the variation is explained.

Simple linear regression

Regression describes how one variable depends on another and is used to predict it. The simple linear model is y = a + bx + error. The least-squares method chooses a and b to minimise the sum of the squared vertical deviations of the points from the line. The slope is b = Sxy/Sxx, where Sxy is the sum of the products of the deviations of x and y from their means and Sxx is the sum of the squared deviations of x; the intercept is a = ȳ − b x̄, so the line always passes through the point of means. The regression of y on x is not the same line as the regression of x on y unless the correlation is perfect; the two slopes multiply to give r².

Calibration is the commonest dairy use. A spectrophotometric method is calibrated with standards of known concentration; absorbance is regressed on concentration, and unknown samples are read off the line. A mid-infrared milk analyser is calibrated by regressing its readings against reference fat results obtained by a gravimetric reference method. A rapid antibiotic test reader, a lactose sensor and a near-infrared powder moisture analyser are all calibrated the same way.

The residuals, the differences between observed values and the line, should scatter randomly around zero with constant spread. A curved pattern means the straight line is the wrong model; a funnel shape means that variance changes with level, often cured by a logarithmic transformation. The standard error of the estimate, the square root of the residual sum of squares divided by n − 2, measures typical prediction error. Predictions are trustworthy only within the range of the calibration standards.

Multiple and non-linear regression

Multiple regression relates y to several predictors: y = b₀ + b₁x₁ + b₂x₂ + … + error. Each coefficient is the change in y for a unit change in that predictor with the others held constant. Cheese yield predicted from milk fat and casein contents, shelf life predicted from storage temperature and initial count, and powder bulk density predicted from feed solids and outlet temperature are typical examples. The coefficients are found by least squares in matrix form, b = (XᵀX)⁻¹XᵀY, which is why matrices are taught first. The adjusted R² penalises the addition of predictors that add little.

Multicollinearity, when predictors are strongly correlated with each other, as fat and protein often are in milk, makes individual coefficients unstable and hard to interpret even when predictions remain good. Indicator (dummy) variables allow categorical factors, such as season or breed, to enter the model.

Many dairy relations are non-linear but can be made linear by transformation. Exponential decay becomes linear on taking logarithms of the response, so a plot of log count against time gives the D value from the slope (D = −1/slope). The Arrhenius relation becomes linear when ln k is plotted against 1/T. A power law, such as the Ostwald–de Waele model for the shear stress of a non-Newtonian cream, τ = Kγⁿ, becomes linear when log τ is plotted against log γ, with slope n. Other models, such as the sigmoid growth curves of Gompertz or Baranyi used in predictive microbiology, are fitted directly by non-linear least squares.

Remember

9. Analysis of variance and basic experimental designs

One-way analysis of variance

Analysis of variance (ANOVA) tests whether the means of three or more groups differ, without the inflated Type I error that comes from many separate t-tests. With five treatments there are ten pairwise comparisons, and running ten t-tests at 5% each gives a much greater than 5% chance of at least one false positive.

ANOVA partitions the total variation, measured by the total sum of squares about the grand mean, into a between-treatments part and a within-treatments (error) part. For k treatments with r replicates each, the treatment sum of squares has k − 1 degrees of freedom and the error sum of squares has k(r − 1). Each sum of squares divided by its degrees of freedom gives a mean square. The F ratio is the treatment mean square divided by the error mean square. If the treatments have no effect, both estimate the same error variance and F is near 1; a large F, beyond the critical value for those degrees of freedom, indicates real differences. The standard layout of the table, with columns for source, degrees of freedom, sum of squares, mean square and F, is a frequent examination item, and a missing entry can always be found because degrees of freedom and sums of squares add up.

A significant F says only that not all means are equal. Which ones differ is found by multiple comparison procedures such as the least significant difference (LSD), Tukey's honestly significant difference, or Duncan's multiple range test. The LSD at 5% is t(0.025, error df) × √(2 × error mean square / r). ANOVA assumes independent errors, normality and equal variances in the groups.

Completely randomised and randomised block designs

Experimental design decides how treatments are allocated to experimental units. Its three principles, set out by R. A. Fisher, are replication, which allows the error to be estimated and reduces it; randomisation, which protects against systematic bias; and local control or blocking, which removes known sources of variation.

In a completely randomised design (CRD) treatments are assigned to units entirely at random. It is the simplest design and suits homogeneous material, such as laboratory trials in which aliquots of one well-mixed batch of milk receive different heat treatments. Its analysis is the one-way ANOVA.

In a randomised complete block design (RCBD) the units are grouped into blocks that are as uniform as possible within themselves, and each treatment appears once in every block, at random. A dairy example is testing four stabilisers in yoghurt using milk from five different days: each day's milk is a block, because milk composition varies from day to day. The ANOVA then has a block line as well as a treatment line, and the variation between days is removed from the error. With t treatments and b blocks the error has (t − 1)(b − 1) degrees of freedom. Blocking is worthwhile when blocks really differ; if they do not, it costs a few error degrees of freedom for little gain. The Latin square design controls two sources of variation at once, such as panellist and serving order in a sensory trial, by arranging t treatments in a t by t grid so that each appears once in every row and every column.

Factorial experiments

A factorial experiment studies two or more factors together, with every level of each factor combined with every level of the others. A 2 by 3 factorial on cheese might combine two renneting temperatures with three calcium chloride doses, giving six treatment combinations. Factorial designs are more efficient than studying one factor at a time, because every observation contributes to the estimate of every main effect, and they are the only way to detect interactions.

An interaction exists when the effect of one factor depends on the level of another. For example, a higher homogenisation pressure may increase the viscosity of a cream liqueur strongly at low fat content and hardly at all at high fat. In the ANOVA of a two-factor experiment the treatment variation is split into the main effect of A (a − 1 degrees of freedom), the main effect of B (b − 1) and the A by B interaction ((a − 1)(b − 1)). When the interaction is significant, main effects must be interpreted with care, and the response is described at each level of the other factor. An interaction plot, with non-parallel lines, shows it at once.

The 2ᵏ factorial, with each of k factors at two levels, is the workhorse of screening experiments. Effects are estimated as the difference between the average response at the high and low levels. When k is large, a fractional factorial runs only a planned fraction of the combinations, at the price of confounding some higher-order interactions with main effects. Split-plot designs are used when one factor is hard to change, such as the pasteuriser temperature, and another is easy, such as the culture added to separate vats.

Remember

10. Introduction to response surface methodology

Why response surfaces

Response surface methodology (RSM) is a set of statistical and mathematical techniques for finding the combination of factor levels that gives the best response, when the relation between factors and response is curved and the factors interact. It was introduced by Box and Wilson in 1951 for chemical processes and is now standard in dairy product development: optimising the levels of fat, sugar and stabiliser in a frozen dessert, the time, temperature and enzyme dose of a lactose hydrolysis, or the inlet temperature, feed rate and atomiser speed of a spray dryer.

RSM proceeds in stages. A screening experiment, usually a two-level factorial or fractional factorial, identifies which of many candidate factors matter. If the current operating region is far from the optimum, the method of steepest ascent moves the experiment in the direction in which a fitted first-order model says the response improves fastest. Near the optimum, curvature becomes important, and a design that can fit a second-order (quadratic) model is run.

The second-order model for two factors is y = b₀ + b₁x₁ + b₂x₂ + b₁₁x₁² + b₂₂x₂² + b₁₂x₁x₂. The squared terms describe curvature and the cross-product term the interaction. Factors are coded, usually so that the low and high levels are −1 and +1 and the centre is 0, which makes the coefficients comparable and the analysis numerically stable. The model is fitted by multiple regression and judged by its R², a lack-of-fit test against replicated centre points, and residual plots.

Central composite and Box–Behnken designs

The central composite design (CCD) is the most widely used design for fitting a quadratic model. It combines three parts: a two-level factorial (or fractional factorial) portion of 2ᵏ points at the corners, 2k axial or star points at a distance α from the centre along each axis, and several replicated centre points. For two factors this gives 4 factorial points, 4 axial points and typically 5 centre points, 13 runs in all. Choosing α = (2ᵏ)^(1/4), which is 1.414 for two factors and 1.682 for three, makes the design rotatable, so that the prediction variance is the same at all points equidistant from the centre. A face-centred design sets α = 1 and keeps all runs within the original factor ranges, which is convenient when extreme levels are impractical.

The Box–Behnken design uses three levels of each factor and places runs at the midpoints of the edges of the experimental region plus centre points, never at the corners. For three factors it needs 12 edge points plus centre points, commonly 15 runs, against 20 for a central composite design with six centre points. It avoids combinations in which all factors are at their extremes at once, which is useful when such a combination would, for example, burn a product or block a dryer.

Replicated centre points serve two purposes: they provide an estimate of pure experimental error, so that lack of fit can be tested, and they reveal curvature, because a difference between the centre-point mean and the factorial-point mean signals that a first-order model is inadequate.

Analysing and using the fitted surface

Once the quadratic model is fitted, the surface is examined to find the best settings. The stationary point is found by setting the partial derivatives with respect to each coded factor to zero and solving the resulting linear equations, which brings together calculus and matrix algebra. Canonical analysis then shows whether the stationary point is a maximum, a minimum or a saddle point, from the signs of the eigenvalues of the matrix of second-order coefficients: all negative means a maximum, all positive a minimum, and mixed signs a saddle. Contour plots and three-dimensional surface plots show the shape of the response and how sensitive it is to each factor.

Real products have several responses at once: an ice cream must be creamy, melt slowly, cost little and meet a minimum total solids standard. Multiple-response optimisation overlays the contour plots or uses a desirability function, which converts each response to a scale from 0 (unacceptable) to 1 (ideal) and maximises their geometric mean. The predicted optimum must always be confirmed by running a verification batch at the chosen settings.

When the factors are proportions of a mixture that must sum to one, such as the fractions of skim milk powder, whey protein concentrate and caseinate in a protein blend, the factors are not independent and ordinary RSM designs do not apply. Mixture designs, such as simplex lattice and simplex centroid designs, are used instead; they are treated in research methods. Common errors are to extrapolate beyond the experimental region, to trust a model with significant lack of fit, and to ignore an important factor held constant during the study.

Remember

What the exams ask

How it is used, across a career

As a student

Practise the hand calculations until they are routine: standardise milk and cream by equations and by the Pearson square, compute D values and cooling times with logarithms, integrate a logged time-temperature curve by the trapezoidal rule, and work a one-way ANOVA table from raw data. Then repeat each with a spreadsheet so you can check yourself. In laboratory classes, compute the mean, standard deviation and confidence interval of your own replicate fat tests; it shows how much a single result can be trusted. Learn which test suits which data, because examinations ask that more often than they ask for arithmetic.

Five years in

A quality or production officer five years into the job uses this mathematics weekly: solving standardisation and recombination balances, checking an analyser calibration line and its residuals, deciding whether a change in a supplier's milk is real with a t-test, setting sample sizes for shelf-life studies, and estimating how long a tank of milk takes to cool after a refrigeration fault. Numerical integration of data-logger records to verify pasteurisation or sterilisation lethality is a routine task. The decision that matters most is knowing when a difference is noise and when it is a signal that needs action.

Twenty-five years in

A plant manager or technical director with 25 years' experience rarely calculates by hand but must judge analyses brought by others: whether a trial was replicated and randomised, whether a claimed improvement in yield is larger than day-to-day variation, whether a regression used to set payment for milk components is valid across the whole range of supplies, and whether a sampling plan really protects the brand. Commissioning factorial or response surface trials before a capital decision on a new dryer or formula is cheaper than learning by production losses.

PhD, twenty-five years in

A professor or research director uses the full toolkit: designing factorial, split-plot and response surface experiments with adequate power, fitting non-linear kinetic and growth models, checking assumptions and choosing transformations, and teaching students to report effect sizes with confidence intervals rather than bare p-values. Reviewing manuscripts and setting examination papers in dairy engineering, chemistry and microbiology depends on catching statistical errors: pseudo-replication, uncorrected multiple comparisons, extrapolated response surfaces, and correlations presented as causes. Building shared datasets and models, such as predictive growth models for the cold chain, extends this work to the whole industry.

Written from

Statistical tables are not reproduced; read critical values of t, chi-square and F from a standard table or software. Vector calculus, Laplace and Fourier transforms, and partial differential equations beyond the explicit finite-difference scheme are only named. Non-parametric tests, generalised linear models for count data, Bayesian methods and mixed models for repeated measures are mentioned but not worked through. Multivariate methods and mixture designs are deferred to research-methods-dairy, and control charts and acceptance sampling to dairy-quality-assurance-sqc.

Original practice questions written to the syllabus and pattern of the exams named in each question's examTags. They are not past papers and do not reproduce any board's questions.

Practise it, and prove it

These notes are free to read here, with no account.

What the Laisha app adds:

Free for ten days, then a subscription. We would rather write that here than have you find it later.

Open Laisha →