View source: R/Confidence_Interval_Beta_Distribution.R
beta.meths.CI | R Documentation |
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.
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
)
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 intervals. |
alpha |
confidence interval confidence level. |
FC |
vector of prey fat content. Note that this vector is
passed to the |
ext.fa |
subset of fatty acids to be used to obtain QFASA diet estimates. |
Note:
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.
Slow because of bisection and lots of repetition.
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.
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.
##### beta.meths.CI is deprecated. Please use conf.meth! #####
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.