Quantification of Lactation Curves for Diagnosis.


title slide

Quantification of Lactation Curves for Diagnosis.

Jim Ehrlich, D.V.M.
Dairy Veterinarians Group
Argyle, NY 12809
jehrlich@dairyvets.com


This is a web page version of a talk given in the Research Summaries session of the annual conference of the American Association of Bovine Practitioners, September 22, 2006 in St. Paul, MN.
© Jim Ehrlich, D.V.M., 2006


To see a larger version of a picture, click on the picture. It will pop up in a separate window.


JLE pic

I would like to show you a tool kit I have developed for the analysis of milk production in dairy cows. Milk production is important, not only because it pays the bills on dairies, but also because it is an extremely sensitive measure of cow health. Almost anything we do to milking cows, or any pathological condition, influences milk production.


http://milkbot.com The first version of this talk that I wrote took half my allotted time before I even got to the point of showing any data. That didn't seem acceptable, so I am going to skip a lot of technical background. That background information is important, so while I don't have time for it here, let me refer you to the MilkBot website

Here, I am reduced to describing MilkBot as a black box which takes milk production data, and summarizes each lactation in the data set as a set of parameter values which characterize the important aspects of the lactation. The data I am showing here comes from a commercial herd with automatic ID and recording of milk weights. We dumped weekly average milk weights into the MilkBot black box.

8662 data points Here is the observed data from a sample lactation. Weekly average milk weights are shown as black dots.
8662 lactation The MilkBot fitting engine fits the observed data to the MilkBot model, as shown by the curve here. It does this by adjusting values for the four parameters, shown in the upper right.
8662 parameter values Parameter values determine the magnitude and shape of the curve.
8662 Standard Error How well the model curve fits the data is shown by the standard error value in the upper left. The fitting engine's task is to minimize this standard error within certain important constraints.
8662 Scale Because of the way the MilkBot model is constructed, parameter values have inherent meaning, which is explained in detail on the web site. The Scale parameter is a simple linear scaler.
8662 Ramp

The Ramp value controls how fast production rises after calving.

8662 Persistence The Persistence value controls how fast production declines, modeled with first-order decay kinetics. I'm not going to dwell on these here, except to say that each parameter controls a single aspect of the curve, so that it is easy to understand what parameter changes will be associated with any change in shape of the curve. With practice, it is not hard to predict parameter values simply by looking at a curve.
8662 reduced parameters Talking of "Models" and "Parameters" adds a layer of abstraction that can be confusing to those not used to thinking in those terms. To simplify explanation, MilkBot can also calculate some reduced parameters, as on this slide showing the same lactation. The values of the previous slide are transformed by simple algebra to the statement that 305-day production is 23,939 pounds of milk, with a peak on day 52 and persistence of 396 days. These numbers summarize the lactation as a whole. You can see, for example, that the model peak at 52 days is not the same as the day of highest observed production. Other descriptions are possible, and it remains to be seen what is most useful and most intuitive for users.
8662 Blips More complicated transformations are also possible. For example, this shows an attempt to quantify variation around the fitted curve. If we assume that the curve represents what we would expect in a perfectly controlled environment, then the "blips" shown in blue represent times when there was a health incident or change in the environment causing production to deviate from normal. Though nothing is recorded in this cow's health record, it is reasonable to assume that there are distinct causes for these blips in production. Anomalies of this sort turn out to be very common, and MilkBot includes tools to look at them in a statistical context.

Now I would like to show you a series of lactations, randomly selected from a normal herd. The point is first to show that MilkBot does an excellent job of calculating plausible curves. Achieving this kind of stability from a computer algorithm was not easy. Second, I want to show the variation which occurs in normal herds, because where there are patterns of variability, there is interesting science to be done. The next level of research is to find and characterize causes for this variation.
8802

This is a first lactation, almost flat with persistence of 581 days and low Scale. If you look carefully, you can see that points in roughly the first and last thirds of the lactation are higher than the curve, and points in the middle are lower. This could be due to herd-wide factors such as changes in weather or feeding, or illness such as a case of mastitis, or possibly that the heifer was started on BST at about 170 days-in-milk.

8336 In this third lactation, production is high and quite consistent, with the exception of a sudden drop from 130 to 110 pounds, right near the peak. That drop, to me, suggests some undiagnosed illness.
8342 A second lactation of about 29,000 pounds, quite similar to the previous one.
8020 A fourth lactation with an early peak and poor persistence. Persistence of 196 days is about one standard deviation below the mean for this herd.
7733 Slightly better persistence than the last slide, also fourth lactation.
8413 Second lactation.
8652 This second lactation, is marked "sold or died" with the comment "mastitis". Clearly something happened at around 60 days. The lactation appears bimodal, ...
8652 ... so I asked Milkbot to fit the points before 60 days in light blue, and after in pink. We could characterize the mastitis event in terms of changes to lactation parameters.
7550 A fifth lactation with early peak and good persistence, though scale and total production are just average.
8706

Another second lactation that starts a bit higher than the previous lactation, but is 5,000 pounds lower in 305-day total production, due to poor persistence.

It is obvious that a single hypothetical "normal lactation curve" does not exist; that shape of lactation curves varies materially between individual cows, and that day-to-day variation around the curve is also highly variable.

summary statistics table

MilkBot quantifies the shape of lactation curves in a systematic and repeatable way, so we can calculate summary statistics. For this group of lactations, mean Scale is 113 pounds with standard deviation of 21. Persistence is 376 days with standard deviation of 174, and so on. These values vary significantly between individuals, groups, and herds. Why?

Multivariate analysis of things correlated to parameter values could be a lot of fun.

Scatter Persistance v. Age at Calving Here is a scatter plot of Persistence versus Age at Calving. Lactations are color-coded by parity, with first lactations colored red, 2nd lactations green, and 3rd or greater blue. The expected relationship between parity and Persistence is visible, and obviously not linear. I find it interesting that within parity groups, Persistence does not seem to be influenced by age, which you can see by looking at any single-color dot set . That is, red dots are first calf heifers, with higher Persistence than the green or blue dots, but within any one color there doesn't seem to be any correlation of Persistence with age.
double histogram, SE

This is a double histogram with horizontal layout and points again colored by parity. Lactations are divided between left and right histograms on the basis of a treatment given to cows on one side. This comes from a pilot study for a trial to evaluate a product that we think may be partially protective against incidents of subacute rumen acidosis (SARA). It's not easy to detect a small reduction in the frequency of a common subclinical disease. One approach we are considering is to look at consistency of production within individual lactations. Here I have plotted standard error of fitted lactations in the two groups, and there doesn't seem to be any difference, though the size of this pilot study was very small. Mean and standard deviation are shown graphically by the black lines in the middle zone.

As I mentioned earlier, we are working on more sophisticated ways to characterize variability in terms of multi-point events which I call "blips" in production. It's a bit complicated devising a good algorithm, but I think it is a very promising approach.

Herd Production Overview My last chart is even more complicated. It monitors group average milk production over time, and tries to seperate controllable factors from fixed factors influencing bulk tank milk.
herd bulk tank milk The thin black line, varying from less than 70 to more than 90 pounds, shows milk per cow per day, bulk tank milk. That total is broken down into three components.
herd lactation scale First, the gray shaded area at the bottom represents cow quality. It changes only slowly as individual cows enter and leave the milking string.
Herd season component On top of that, brown arrows represent the lactation stage component. For each lactation, the difference between that day's expected production and the mean for the entire lactation is calculated, and these differences are averaged for the group. When there are many cows near peak production, values will be positive, as in the middle portion of this chart. When there are a lot of cows either pre-peak, as on the left side, or post-peak as on the right side, then the lactation stage effect will be negative.
Herd Management Milk The remainder, portrayed as a green arrow, is the unexplained difference, or effect of management plus environment. There is a lot of calculation going on here.
Herd MM Only

In many ways this last component is the most interesting, yielding an accurately normalized portrait of day-to-day changes, which may be due to things like feed quality, heat stress, or irregularities in the milking or feeding routines. The normalized picture can be quite different from the raw production curve, as it is in this example.

This chart is complex, so let me re-state how it is calculated from the viewpoint of a single lactation.

decomposed lactation 8285 Here is a sample lactation. I will magnify the outlined area in my next slide. Black dots are observed milk production. The gray zone represents average production from zero to 305 days.
 enlarged decomposed lactation

I have marked two examples. At 25 days-in-milk, which is pre-peak, milk production is expected to be below the gray lactation average by about 7 pounds. The brown arrow on the left points down by seven pounds. Observed production was about 12 pounds below expectations, so after removing the minus seven lactation stage effect, the unexplained residual, or "management effect" is minus 5 pounds.

Seven weeks later at 70 days-in-milk, the lactation stage effect is plus 14 pounds (the brown arrow on the right). The black dot for observed production is again about five pounds below the model curve.

annotated chart The chart averages the arrows for each lactation in the group for a each date on the chart.



I have touched on three parts of MilkBot technology in this talk. First is the lactation model, which is described on the MilkBot website. Second is the fitting engine that fits observed data to the model producing a set of directly interpretable parameter values. This is proprietary technology belonging to me, but available for use by others. Third is the software I wrote to help explore parameter values generated by the fitting engine and generate these slides. These three parts can be used separately, but together they make a package which has vast potential application to problems in dairy science.

For example:

This is the first public demonstration of MilkBot technology. Most of the development has been done by me as a personal obsession and without outside funding. My hope is that some of you will see the power that detailed quantitative analysis of lactation curves can provide, and give MilkBot a chance to prove its value in your own research. I am looking for collaborators to help move this on to the next level.

Thank you.