bias.all: Calculate bias correction for confidence intervals from...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
bias.all(p.mat, prey.mat, cal.mat = rep(1, length(ext.fa)),
  fat.cont = rep(1, nrow(prey.mat)), R.bias, noise, nprey, specify.noise,
  dist.meas, ext.fa)

Arguments

p.mat

matrix containing the fatty acid signatures of the predators.

prey.mat

matrix containing a representative fatty acid signature

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.

fat.cont

prey fat content

R.bias

botstrap replicates

noise

noise

nprey

number of prey

specify.noise

noise

dist.meas

distance measure

ext.fa

subset of FA's to use.

Value

Row 1 is Lambda CI, row 2 is Lambda skew, and row 3 is Beta CI

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
## 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
# 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']]
# 
# bias <- bias.all(p.mat = diet.est,
#                  prey.mat = prey.matrix.full,
#                  cal.mat = cal.mat,
#                  R.bias = 10,
#                  noise = 0,
#                  nprey = 50,
#                  dist.meas = 2,
#                  ext.fa = fa.set)

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