目录

Calculating the proportions of mixed nuts

I had a can of mixed nuts -- cashews, almonds, pistachios, pecans -- in the order written on the package, which also seems to be the order of their proportions. As a rough guess, 50% cashews, 40% almonds, 8% pistachios and 2% pecans. Considering their unit prices, this is not surprising. The problem is their proportions are not listed anywhere on the package. Such information is crucial for customers to determine its value. (I tried another product, which also does not list them. But at least the contents are visible, since part of its plastic package is transparent.)

I assume such products are not required to list the proportions. However, what is required is nutrition facts. They may contain enough information to uncover what have been concealed. All we need is a set of linear equations.

The following table lists the nutrition facts of the mixed nuts and of each of its components (data from USDA). I omitted fat and sodium because the mixed nuts contain oil and salt. Unit is mg, per 1oz≈28g nuts.

MixedCashewAlmondPistachioPecan
Total carb70009300600078003900
Dietary Fiber2000850310029002700
Sugar10001400140022001200
Protein50004300600060002700
Calcium4013763020
Iron1.31.71.11.10.8
Potassium180160200290120
Phosphorus13014013013083
Magnesium7074793137
Zinc1.11.60.940.661.4
Copper0.40.630.310.370.33
Manganese0.60.230.630.351.1
Vitamin E3.10.266.80.620.37

The first column must be a weighted average of the other four. The four weightings (i.e. proportions) sum to 1, so there are only 3 free variable. This means we only need 3 equations to find the solution. We have more than enough (12), so we can treat this as an ordinary least squares problem. The proportions are just the regression coefficients that minimize squared error, which can be calculated through this formula. I rescaled each row such that the first entry (y) equals 1. This makes sure that each row contributes roughly equally to the loss.

(A quick look at the numbers suggests that the row for "Sugar" isn't right. The value for mixed nuts is lower than any of its components. Perhaps this is due to low precision (only one significant figure). I excluded it from the calculation.)

The result is 35% cashews, 42% almonds, 6% pistachios and 17% pecans. Apart from overestimating the proportion of pecans, this looks reasonable. If 4 rows with larger loss are removed, the remaining 8 rows yield the numbers 40%, 42%, 5% and 12%, which seems even better.

So, nutrition facts allow us to get a reasonably good estimate of the proportions of mixed nuts, but no customers are expected to do such calculation when they pick up the product from the shelf in a store. Manufacturers should be obliged to show not only the ingredients but also their quantity, as consumers have the right to be informed. And the name of the product can be more accurate too -- in this case, it should really be called "Cashews and almonds, supplemented with pistachios and pecans".


Data from USDA
Nuts, cashew nuts, dry roasted, with salt added
Nuts, almonds, dry roasted, with salt added
Nuts, pistachio nuts, dry roasted, with salt added
Nuts, pecans, dry roasted, with salt added