beta.meths.CI: Returns individual confidence intervals and simultaneous...

Description Usage Arguments Details Value References Examples

Description

For details see: Stewart, C. (2013) Zero-Inflated Beta Distribution for Modeling the Proportions in Quantitative Fatty Acid Signature Analysis. Journal of Applied Statistics, 40(5), 985-992.

Usage

1
2
3
beta.meths.CI(predator.mat, prey.mat, cal.mat = rep(1, length(ext.fa)),
  dist.meas, noise = 0, nprey, R.p, R.ps, R, p.mat, alpha, FC = rep(1,
  nrow(prey.mat)), ext.fa)

Arguments

predator.mat

matrix containing the fatty acid signatures of the predators.

prey.mat

prey database. A dataframe with first column a Species label and other columns fatty acid proportions. Fatty acid proportions are compositional.

cal.mat

matrix of calibration coefficients of predators. Each column corresponds to a different predator. At least one calibration coefficient vector must be supplied.

dist.meas

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

noise

proportion of noise to include in the simulation.

nprey

number of prey to sample from the the prey database when generating pseudo-predators for the nuisance parameter estimation.

R.p

number of beta diet distributions to generate for the nuisance parameters.

R.ps

number of pseudo predators to generate when estimating nuisance parameters.

R

number of bootstrap replicates to use when generating p-values for confidence interval estimation.

p.mat

matrix of predator diet estimates for which we are trying to find confidence interavls.

alpha

confidence interval confidence level.

FC

vector of prey fat content. Note that this vector is passed to the gen.pseudo.seals which expects fat content values for individual prey samples while pseudo.seal and p.QFASA expect a species average.

ext.fa

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

Details

Note:

Value

Individual confidence intervals and simultaneous confidence intervals based on the zero-inflated beta distribution. These intervals are biased and should be corrected using the output from bias.all. ci.l.1 and ci.u.1 contain the simultaneous confidence intervals.

References

Stewart, C. (2013) Zero-inflated beta distribution for modeling the proportions in quantitative fatty acid signature analysis. Journal of Applied Statistics, 40(5), 985-992.

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
## Fatty Acids
data(FAset)
fa.set = as.vector(unlist(FAset))
 
## Predators
data(predatorFAs)
tombstone.info = predatorFAs[,1:4]
predator.matrix = predatorFAs[, fa.set]
npredators = nrow(predator.matrix)

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

## Calibration Coefficients
data(CC)
cal.vec = CC[CC$FA %in% fa.set, 2]
cal.mat = replicate(npredators, cal.vec)

# Note: uncomment examples to run. CRAN tests fail because execution time > 5 seconds
# set.seed(1234)
# diet.est <- p.QFASA(predator.mat = predator.matrix,
#                     prey.mat = prey.matrix,
#                     cal.mat = cal.mat,
#                     dist.meas = 2,
#                     start.val = rep(1,nrow(prey.matrix)),
#                     ext.fa = fa.set)[['Diet Estimates']]
# 
# ci = beta.meths.CI(predator.mat = predator.matrix,
#                    prey.mat = prey.matrix.full,
#                    cal.mat = cal.mat,
#                    dist.meas = 2,
#                    nprey = 10,
#                    R.p = 1,
#                    R.ps = 10, #
#                    R = 1, 
#                    p.mat = diet.est,
#                    alpha = 0.05,
#                    ext.fa = fa.set)

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