p.QFASA: Returns QFASA diet estimates corresponding to a sample of...

View source: R/qfasa.R

p.QFASAR Documentation

Returns QFASA diet estimates corresponding to a sample of predators.

Description

Computes the diet estimate for each predator in predator.mat using either the Kullback-Leibler Distance (KL), the Aitchison Distance (AIT) or the Chi-Square Distance (CS).

Usage

p.QFASA(
  predator.mat,
  prey.mat,
  cal.mat,
  dist.meas,
  gamma = 1,
  FC = rep(1, nrow(prey.mat)),
  start.val = rep(0.99999, nrow(prey.mat)),
  ext.fa
)

Arguments

predator.mat

matrix containing the FA signatures of the predators.

prey.mat

matrix containing a representative FA signature from each prey group (usually the mean). The first column must index the prey group. Note can use function MEANmeth to calculate the means.

cal.mat

matrix of calibration factors where the i th column is to be used with the i th predator. If modelling is to be done without calibration coefficients, simply pass a vector or matrix of ones.

dist.meas

distance measure to use for estimation: 1=KL, 2=AIT or 3=CS

gamma

parameter required for calculations using CS distance (passed to CS.obj). Currently being set to 1.

FC

vector of fat content of length equal to the number of prey groups or species.

start.val

initial vector of parameters to be optimized

ext.fa

subset of fatty acids to be used to obtain QFASA diet estimates.

Details

Before carrying out an analysis using QFASA, rows of prey database must be normalized to sum to one. See Example for code that extracts a subset of FAs and then normalizes the prey database signatures.

Value

A list with components:

Diet Estimates

A matrix of the diet estimates for each predator where each row corresponds to a predator and the columns to prey species. The estimates are expressed as proportions summing to one.

Additional Measures

For each predator for which a diet estimate was obtained:

ModFAS

the value of the modelled fatty acid. These are expressed as proportions summing to one.

DistCont

The contribution of each fatty acid to the final minimized distance.

PropDistCont

The contribution of each fatty acid to the final minimized distance as a proportion of the total.

MinDist

The final minimized distance.

References

Iverson, Sara J., Field, Chris, Bowen, W. Don and Blanchard, Wade (2004) Quantitative Fatty Acid Signature Analysis: A New Method of Estimating Predator Diets. Ecological Monographs, 74(2), 211-235

Examples

 ## Fatty Acids
 data(FAset)
 fa.set = as.vector(unlist(FAset))

 ## Predators
 data(predatorFAs)
 tombstone.info = predatorFAs[,1:4]
 predator.matrix = predatorFAs[,5:(ncol(predatorFAs))]
 npredators = nrow(predator.matrix)

 ## Prey
 data(preyFAs)
 prey.sub=(preyFAs[,4:(ncol(preyFAs))])[fa.set]
 prey.sub=prey.sub/apply(prey.sub,1,sum)
 group=as.vector(preyFAs$Species)
 prey.matrix=cbind(group,prey.sub)
 prey.matrix=MEANmeth(prey.matrix)

 ## Fat Content

 FC = preyFAs[,c(2,3)]
 FC = as.vector(tapply(FC$lipid,FC$Species,mean,na.rm=TRUE))

 ## Calibration Coefficients
 data(CC)
 cal.vec = CC[,2]
 cal.mat = replicate(npredators, cal.vec)

 ## Run QFASA
 Q = p.QFASA(predator.matrix,
             prey.matrix,
             cal.mat,
             dist.meas = 1,
             gamma=1,
             FC,
             start.val = rep(1,nrow(prey.matrix)),
             fa.set)

## Diet Estimates
DietEst = Q$'Diet Estimates'


QFASA documentation built on Nov. 17, 2023, 1:08 a.m.