Learn R Programming

QFASA (version 1.2.1)

Quantitative Fatty Acid Signature Analysis

Description

Accurate estimates of the diets of predators are required in many areas of ecology, but for many species current methods are imprecise, limited to the last meal, and often biased. The diversity of fatty acids and their patterns in organisms, coupled with the narrow limitations on their biosynthesis, properties of digestion in monogastric animals, and the prevalence of large storage reservoirs of lipid in many predators, led to the development of quantitative fatty acid signature analysis (QFASA) to study predator diets.

Copy Link

Version

Install

install.packages('QFASA')

Monthly Downloads

258

Version

1.2.1

License

MIT + file LICENSE

Maintainer

Connie Stewart

Last Published

August 27th, 2024

Functions in QFASA (1.2.1)

chisq.CA

Called by create.d.mat() to compute the chi-square distance.
chisq.dist

Returns the distance between two compositional vectors using the chi-square distance.
bestSubset

Find the pair of starting species with the best (lowest) IC value among all possible pairs of species in prey.mat Used in forward selection when no starting species are specified
conf.meth

Confidence Intervals for Diet Proportions
POOLVARmeth

Computes within species variance-covariance matrices on transformed scaled, along with a pooled estimate.
beta.meths.CI

Returns individual confidence intervals and simultaneous confidence intervals based on the zero-inflated beta distribution (not bias corrected - see note below).
comp.rep

Repeatability in Diet Estimates
evaluateModel

Get nll and IC values for a given model (note that the model is determined by the species included in prey.mat - prey.mat is adjusted to add or remove species before entering this function
comp.beta.pval.k

Calculate p-value corresponding to a specified null value using bootstrapping
evaluateCombination

Get nll and IC values for a pair of species (this is used in forward selection if the starting species are not specified; used on a list of all possible combinations of two species)
comp.Tstar.beta

Generate bootstrap replicates of diet proportion estimates for given prey species
mod.zeros.FA.sig

Modifies the zeros for a single FA signature using the multiplicative replacement method (and same delta for every zero).
beta.pval.k

Calculate p-value of a given prey type diet proportion under the predator diets and estimated diet distribution provided.
opt.beta.lim

Find simultaneous confidence intervals for diet proportions of a single prey species i.e. solve f(pio) = PVAL(pio) = alpha1. Calls root finding function root.beta.
comp.gen.pseudo.seals

Generate pseudo predators with ith predator having true diet given by ith row of diet.null.mat.
comp.p.beta

Bootstrap statistic function: in this case it is the mean (meanBEZI) of the fitted (gamlss) ZIB distribution.
bias.all

Calculate bias correction for confidence intervals from beta.meths.CI.
multiplicativeReplacement

Multiplicative replacement of zeroes
bias.comp

Calculate bias correction for confidence intervals.
bisect.beta.lim

Find simultaneous and individual confidence intervals for diet proportions of a single prey species i.e. solve f(pio) = PVAL(pio) = alpha1 and f(pio) = PVAL(pio) = alpha2 using bisection.
data.sim.beta

Bootstrap ran.gen function:
mod.zeros.FA.sig.mat

Modifies the zeros for a sample of FA signatures using the multiplicative replacement method (and same delta for every zero).
p.MLE

Returns simplified MLE diet estimates corresponding to a sample of predators.
dummy

Roxygen commands
p.sim.QFASA

Simultaneous estimation of diet composition and calibration coefficients
forward.selection

Returns diet estimates corresponding to a sample of predators based on a forward selection algorithm that chooses the prey species to be included in the modelling.
gen.pseudo.seals

Generate pseudo predators with ith predator having true diet given by ith row of diet.null.mat.
p.QFASA

Returns QFASA diet estimates corresponding to a sample of predators.
testfordiff.ind.boot.fun

Called by testfordiff.ind.boot().
p.SMUFASA

Simultaneous maximum unified fatty acid signature analysis
p.beta

Bootstrap statistic function: in this case it is the mean (meanBEZI) of the fitted (gamlss) ZIB distribution.
rho.boot.fun

RETURNS RHO AND THE BOOTSTRAP SAMPLE DETERMINED BY ind.
pseudo.seal

Generate a single pseudo predator FA signature
likelihoodEstimates

Get simplified MLE estimates
pseudo.pred

Generate a pseudo predator by sampling with replacement from prey database.
prey.on.prey

Each prey fatty acid signature is systematically removed from the supplied prey database and its QFASA diet estimate is obtained by treating the individual as a predator.
create.d.mat

Called by testfordiff.ind.boot.fun() to create a matrix of distances.
testfordiff.ind.boot

Called by testfordiff.ind.pval().
split_prey

Splits prey database into a simulation set (1/3) and a modelling set (2/3). Returns a list:
p.MUFASA

Returns MUFASA diet estimates corresponding to a sample of predators.
mean_geometric

Returns the geometric mean of a compositional vector
cs_distance.mat

CALCULATE CS DISTANCE BETWEEN EACH TWO PREDATORS IN dataset
preyFAs

Prey fatty acid signatures. Each prey signature is a row with fatty acid proportions in columns.
testfordiff.ind.pval

Test for a difference between two independent samples of compositional data. Zeros of any type are allowed.
prey.cluster

Produces a dendrogram using distances between the mean FA signatures of the prey types.
unbal.rho.jack.fun

FUNCTION TO BE PASSED TO bootstrap::jackknife.
unbal.two.factor.rep

Measure of (unadjusted) repeatability with missing values
predatorFAs

Predator fatty acid signatures. Each predator signature is a row with fatty acid proportions in columns.
pseudo.pred.norm

Generate a pseudo predator parametrically from multivariate normal distributions.
unbal.rho.boot.fun

RETURNS RHO AND THE BOOTSTRAP SAMPLE DETERMINED BY ind.
root.beta

Find root (i.e. solve f(pio) = PVAL(pio) = alpha1 using either uniroot or optimize.
pseudo.pred.table

FUNCTION TO GENERATE ns SEALS FOR EACH OF ny YEARS
unbal.rep.CI

Measure of Repeatability for Diet Estimates (Unbalanced/Missing Value Case)
pseudo.pred.rep

FUNCTION TO GENERATE ns PSEUDO SEALS WHERE ns IS THE NUMBER OF ROWS IN diet.mat.seal AND RETURNS THE CORRESPONDING QFASA DIET ESTIMATES. ASSUMES EACH ROW IS A DIET VECTOR AND EACH COLUMN CORRESPONDS TO 1 PREY SPECIES IN THE DIET
rho.jack.fun

FUNCTION TO BE PASSED TO bootstrap::jackknife.
zeroEstimates

Reintroduce excluded species to diet estimates as forced zeroes
unbal.diet.data

Sample example of unbalanced repeatability diet estimates data with a max of two repeated measurements per predator.
uniroot.beta

Use uniroot() to find roots and compare with bisection outcome
two.factor.rep

Measure of (unadjusted) repeatability
CC

Fatty acid calibration coefficients.
AIT.obj

Used in solnp() as the objective function to be minimized when Aitchison distance measure is chosen.
CS.obj

Used in solnp() as the objective function to be minimized when chi-square distance measure is chosen. Unlike AIT.obj() and KL.obj(), does not require modifying zeros.
KL.dist

Returns the distance between two compositional vectors using Kullback--Leibler distance measure.
KL.obj

Used in solnp() as the objective function to be minimized when Kullback--Leibler distance measure is chosen.
CS.more

Used to provide additional information on various model components evaluated at the optimal solution, i.e., using the QFASA diet estimates and chi-square distance measure.
AIT.dist

Returns the distance between two compositional vectors using Aitchison's distance measure.
AIT.more

Used to provide additional information on various model components evaluated at the optimal solution, i.e., using the QFASA diet estimates and Aitchison distance measure.
KL.more

Used to provide additional information on various model components evaluated at the optimal solution, i.e., using the QFASA diet estimates and Kullback-Leibler distance measure.
QFASA

QFASA: A package for Quantitative Fatty Acid Signature Analysis
backward.elimination

Returns diet estimates corresponding to a sample of predators based on a backward elimination algorithm that chooses the prey species to be included in the modelling.
MEANmeth

Returns the multivariate mean FA signature of each prey group entered into the QFASA model. Result can be passed to prey.mat in p.QFASA().
bal.rep.CI

Measure of Repeatability for Diet Estimates (Balanced Case)
Tstar.beta

Generate bootstrap replicates of diet proportion estimates for given prey species
bal.diet.data

Sample example of balanced repeatability diet estimates data with only two repeated measurements per predator.
FAset

List of fatty acids used in sample prey and predator data sets, preyFAs and predatorFAs respectively.
bestForwardModel

Finds the species combination with the best# (lowest) IC value achievable by adding a single species from full.prey.mat. Used for each iteration of forward selection.
bestBackwardModel

Finds the species combination with the best (lowest) IC value achievable by dropping a single species from the prey.mat. Used for each iteration of backward elimination.
QFASA.const.eqn

Returns sum(alpha) and used in solnp().