data(preyFAs)
# Generating a sample of 10 pseudo predators each with "true" diet being
# (1/11,1/11,...1/11), no calibration effect and no fat content. The QFASA diet estimate
# is then computed for each pseudo predator.
# Note: To incorporate calibration and fat content in a simulation study,
# one set of calibration and fat content is generally used to simulate the pseudo predator
# and another is used to estimate the diet.
set.seed(11)
p.mat <- matrix(rep(NA,10*11),nrow=10)
for (i in 1: 10) {
my.seal <- pseudo.pred(rep(1/11,11),
preyFAs[,-c(1,3)],
rep(1,ncol(preyFAs[,-c(1,3)])-1),
rep(1,11))
p.mat[i,] <- p.QFASA(my.seal,
MEANmeth(preyFAs[,-c(1,3)]),
rep(1,length(my.seal)),
2,
ext.fa=colnames(preyFAs[,-c(1:3)]))$`Diet Estimates`
}
# Can verify that average diet estimate of the 10 pseudo predators is close to
# "true" diet.
colnames(p.mat) <- as.vector(rownames(MEANmeth(preyFAs[,-c(1,3)])))
round(apply(p.mat,2,mean),3)
Run the code above in your browser using DataLab