Find realistic bootstrap sample sizes
Description
In QFASA simulation studies, predator signatures are often simulated by
bootstrap resampling prey signature data. find_boot_ss
finds
bootstrap sample sizes for each prey type that produce simulated predator
signatures with realistic levels of variation.
Usage
1  find_boot_ss(pred_sigs, pred_diets, prey_sigs, prey_loc, n_pred_boot = 1000)

Arguments
pred_sigs 
A vector or matrix of predator signatures, intended to be
the object 
pred_diets 
A numeric matrix of the estimated diet compositions of
individual predators, intended to be the object 
prey_sigs 
A matrix of prey signatures, intended to be the object

prey_loc 
A matrix giving the first and last locations of the
signatures of each prey type within 
n_pred_boot 
An integer designating the number of predator signatures to bootstrap. See Details. Default value 1000. 
Value
A list containing the following elements:
 var_diet
A numeric vector of the variance between the estimated diets of all possible pairs of predators, sorted in increasing order.
 var_sig
A numeric vector of the variance between the signatures of all possible pairs of predators, sorted consistently with
var_diet
.
 var_sig_smooth
A loesssmoothed version of var_sig.
 mod_sig_var
A numeric vector of the modeled variance between bootstrapped predator signatures at each iteration of the algorithm.
 var_target
The target level of variance between bootstrapped predator signatures.
 boot_ss
An integer vector of bootstrap sample sizes for each prey type.
 err_code
An integer error code (0 if no error is detected).
 err_message
A string containing a brief summary of the results.
Details
QFASA simulation studies may require the generation of predator signatures given a specified diet, against which estimates of diet composition can then be compared (e.g., Bromaghin et al. 2015). Given a specified diet, a bootstrap sample of each prey type is drawn and mean preytype signatures are computed. A predator signature is then generated by multiplying the mean bootstrapped prey signatures by the diet proportions.
Although authors often fail to report the bootstrap sample sizes used for each prey type when describing simulations (e.g., Haynes et al. 2015; Thiemann et al. 2008; Wang et al. 2010), they are subjectively selected (e.g., Iverson et al. 2004; Bromaghin et al. 2015). However, Bromaghin et al. (2016) found that bootstrap sample sizes strongly influence both the bias and the variance of diet composition estimates in simulation studies. Consequently, the selection of bootstrap sample sizes is an important aspect of simulation design.
Bromaghin (2015) presented an objective method of establishing a bootstrap
sample size for each prey type that produces simulated predator signatures
having a realistic level of betweensignature variation. The function
find_boot_ss
implements the algorithm of Bromaghin (2015). A
brief summary of the algorithm, sufficient to understand the objects returned
by find_boot_ss
, follows below. Please refer to Bromaghin (2015) for
additional details.
The concept underlying the algorithm is that the variation in predator
signatures can be partitioned into variation due to differences in diet and
variation due to prey animals consumed given diet. Consequently, a realistic
level of variation between signatures for predators sharing the same diet is
approximated from the empirical relationship between a measure of variation
between pairs of predator signatures var_sig
and a measure of
variation between the estimated diets var_diets
of the same predator
pairs. As the variance in diets approaches zero, the predators are
effectively eating the same diet and variation in their signatures therefore
approaches the level of variation due to prey selection only.
find_boot_ss
models the relationship between var_diet
and var_sig
using a loess smooth, and the modeled signature variance
var_sig_smooth
for the pair of predators whose value of
var_diet
is smallest is taken as the target level of variation for
predator signatures.
The algorithm is initialized with a sample size of 1 from each prey type.
A sample of n_pred_boot
predator signatures is generated using those
sample sizes and the measure of variance among the signatures is computed.
If the variance measure exceeds the target level, the prey type contributing
most to the variance measure is identified and its sample size is increased
by 1. The algorithm then iterates, increasing the sample size by one at each
iteration, until the measure of variation is less than the target level. The
level of variation at each iteration and the target level of variation are
returned in the objects mod_sig_var
and var_terget
,
respectively.
The argument n_boot_pred
should be large enough to return an estimate
of the variance measure that itself has low variance, so that the algorithm
returns numerically stable results. We suspect that the default value of 1000
errs on the side of caution.
NOTE: Because find_boot_ss
is intended to operate on the predator and
prey signatures returned by a call to the function est_diet
,
find_boot_ss
can be based on diet estimates obtained in either the
predator or prey space, using an original or partitioned prey library.
However, it is imperative that the arguments are compatible.
References
Bromaghin, J.F. 2015. Simulating realistic predator signatures in quantitative fatty acid signature analysis. Ecological Informatics 30:6871.
Bromaghin, J.F., S.M. Budge, and G.W. Thiemann. 2016. Should fatty acid signature proportions sum to 1 for diet estimation? Ecological Research 31:597606.
Bromaghin, J.F., K.D. Rode, S.M. Budge, and G.W. Thiemann. 2015. Distance measures and optimization spaces in quantitative fatty acid signature analysis. Ecology and Evolution 5:12491262.
Haynes, T.B., J.A. Schmutz, J.F. Bromaghin, S.J. Iverson, V.M. Padula, and A.E. Rosenberger. 2015. Diet of yellowbilled loons (Gavia adamsii) in Arctic lakes during the nesting season inferred from fatty acid analysis. Polar Biology 38:12391247.
Iverson, S.J., C. Field, W.D. Bowen, and W. Blanchard. 2004. Quantitative fatty acid signature analysis: A new method of estimating predator diets. Ecological Monographs 74:211235.
Thiemann, G.W., S.J. Iverson, and I. Stirling. 2008. Polar bear diets and Arctic marine food webs: insights from fatty acid analysis. Ecological Monographs 78:591613.
Wang, S.W., T.E. Hollmen, and S.J. Iverson. 2010. Validating quantitative fatty acid signature analysis to estimate diets of spectacled and Stellers eiders (Somateria fischeri and Polysticta stelleri). Journal of Comparative Physiology B 180:125139.
Examples
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 40 41 42 43 44 45 46  find_boot_ss(pred_sigs = matrix(c(0.05, 0.10, 0.30, 0.55,
0.04, 0.11, 0.29, 0.56,
0.10, 0.05, 0.35, 0.50,
0.12, 0.03, 0.37, 0.48,
0.10, 0.06, 0.35, 0.49,
0.05, 0.15, 0.35, 0.45), ncol = 6),
pred_diets = matrix(c(0.33, 0.34, 0.33,
0.10, 0.80, 0.10,
0.35, 0.50, 0.15,
0.20, 0.35, 0.45,
0.20, 0.45, 0.35,
0.15, 0.65, 0.20), ncol = 6),
prey_sigs = matrix(c(0.06, 0.09, 0.31, 0.54,
0.05, 0.09, 0.30, 0.56,
0.03, 0.10, 0.30, 0.57,
0.08, 0.07, 0.30, 0.55,
0.09, 0.05, 0.33, 0.53,
0.09, 0.06, 0.34, 0.51,
0.09, 0.07, 0.34, 0.50,
0.08, 0.11, 0.35, 0.46,
0.06, 0.14, 0.36, 0.44), ncol = 9),
prey_loc = matrix(c(1, 4, 7, 3, 6, 9), ncol=2),
n_pred_boot = 500)
find_boot_ss(pred_sigs = matrix(c(0.05, 0.10, 0.30, 0.55,
0.04, 0.11, 0.29, 0.56,
0.10, 0.05, 0.35, 0.50,
0.12, 0.03, 0.37, 0.48,
0.10, 0.06, 0.35, 0.49,
0.05, 0.15, 0.35, 0.45), ncol = 6),
pred_diets = matrix(c(0.33, 0.34, 0.33,
0.10, 0.80, 0.10,
0.35, 0.50, 0.15,
0.20, 0.35, 0.45,
0.20, 0.45, 0.35,
0.15, 0.65, 0.20), ncol = 6),
prey_sigs = matrix(c(0.06, 0.09, 0.31, 0.54,
0.05, 0.09, 0.30, 0.56,
0.03, 0.10, 0.30, 0.57,
0.08, 0.07, 0.30, 0.55,
0.09, 0.05, 0.33, 0.53,
0.09, 0.06, 0.34, 0.51,
0.09, 0.07, 0.34, 0.50,
0.08, 0.11, 0.35, 0.46,
0.06, 0.14, 0.36, 0.44), ncol = 9),
prey_loc = matrix(c(1, 4, 7, 3, 6, 9), ncol=2))
