p.QFASA: Computes the diet estimate for each predator in seal.mat...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
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.

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

start.val

initial vector of parameters to be optimized

ext.fa

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

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 (i.e., after CCs have been applied and the fatty acids subsetted and renormalised over the designated fatty acid set). 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.

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
 ## 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) 

 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)
 

QFASA documentation built on June 15, 2019, 1:03 a.m.