Input data for assessing the diet composition of mink in southeast Alaska, using C and N isotope ratios (d13C and d15N).
The data consist of
the input matrix Prey
, which contains the C (1st row) and N
(2nd row) isotopic values of the prey items (columns), corrected for
fractionation.
the input vector Mink
, with the C and N isotopic value of
the predator, mink
There are seven prey items as food sources:
fish
mussels
crabs
shrimp
rodents
amphipods
ducks
The d13C and d15N for each of these prey items, and for mink (the predator) was assessed. The isotopic values of the preys were corrected for fractionation.
The problem is to find the diet composition of mink, e.g. the fraction of each of these food items in the diet.
Mathematically this is by solving an lsei (least squares with equalities and inequalities) problem: Ex=f subject to Gx>h.
The equalities Ex=f:
d13CMink = p1*d13Cfish+p2*d13Cmussels + .... + p7*d13Cducks
d15NMink = p1*d15Nfish+p2*d15Nmussels + .... + p7*d15Nducks
1 = p1+p2+p3+p4+p5+p6+p7
and inequalities Gx>h:
pi >= 0
are solved for p1,p2,...p7.
The first two equations calculate the isotopic ratio of the consumer (Mink) as a weighted average of the ratio of the food sources
Equation 3 assures that the sum of all fraction equals 1.
As there are 7 unknowns and only 3 equations, the model is UNDERdetermined, i.e. there exist an infinite amount of solutions.
This model can be solved by various techniques:
least distance programming will select the "simplest" solution.
See ldei
.
the remaining uncertainty ranges of the fractions can be estimated
using linear programming. See xranges
the statistical distribution of the fractions can be estimated using
an MCMC algorithm which takes a sample of the solution space.
See xsample
1 
a list with matrix Prey
and vector Mink
.
Prey
contains the isotopic composition (13C and 15N) of the
7 possible food items of Mink
Mink
contains the isotopic composition (13C and 15N) of Mink
columnnames of Prey
are the food items, rownames of Prey
(=names of Mink) are the names of the isotopic elements.
Karline Soetaert <karline.soetaert@nioz.nl>
BenDavid M, Hanley TA, Klein DR, Schell DM (1997) Seasonal changes in diets of coastal and riverine mink: the role of spawning Pacific salmon. Canadian Journal of Zoology 75:803811.
ldei
to solve for the parsimonious solution
xranges
to solve for the uncertainty ranges
xsample
to sample the solution space
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  # 1. visualisation of the data
plot(t(Minkdiet$Prey), xlim = c(25, 13), xlab = "d13C", ylab = "d15N",
main = "Minkdiet", sub = "BenDavid et al. (1979)")
text(t(Minkdiet$Prey)0.1, colnames(Minkdiet$Prey))
points(t(Minkdiet$Mink), pch = 16, cex = 2)
text(t(Minkdiet$Mink)0.15, "MINK", cex = 1.2)
legend("bottomright", pt.cex = c(1, 2), pch = c(1, 16),
c("food", "predator"))
# 2. Generate the food web model input matrices
# the equalities:
E < rbind(Minkdiet$Prey, rep(1, 7))
F < c(Minkdiet$Mink, 1)
# the inequalities (all pi>0)
G < diag(7)
H < rep(0, 7)
# 3. Select the parsimonious (simplest) solution
parsimonious < ldei(E, F, G = G, H = H)
# 4. show results
data.frame(food = colnames(Minkdiet$Prey),
fraction = parsimonious$X)
dotchart(x = as.vector(parsimonious$X), labels = colnames(Minkdiet$A),
main = "Estimated diet composition of Mink",
sub = "using ldei and xranges", pch = 16)
# 5. Ranges of diet composition
iso < xranges(E, F, ispos = TRUE)
segments(iso[,1], 1:ncol(E), iso[,2], 1:ncol(E))
legend ("topright", pch = c(16, NA), lty = c(NA, 1),
legend = c("parsimonious", "range"))
pairs (xsample(E = E, F = F, G = diag(7), H = rep(0, 7), iter = 1000)$X,
main = "Minkdiet 1000 solutions, using xsample")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.