genboot: Generate bootstrap estimates of mixed stock analyses

Description Usage Arguments Value Examples

View source: R/mixstock.R

Description

Given a data set or simulated data set (in the usual format of a list of source samples and samples from the mixed stock), generate bootstrap-resampled data sets (either parametrically or nonparametrically) and a vector of estimates from the resampled data sets

Usage

1
2
3
4
genboot(x, method="cml", nboot=1000, rseed=1001, verbose=FALSE,
fuzz=0.001, maxfail=100, pb=TRUE, start.type="lsolve",
param=FALSE,param.match="mean",ndepfac=10000,save.boot=FALSE,
print.boot=FALSE,...)

Arguments

x

A mixed stock data set: a list with elements sourcesamp (a matrix, with sources as columns and markers as rows, of samples in the sources) and mixsamp (a vector of markers sampled in the mixed stock)

method

"cml" for conditional max. likelihood or "uml" for unconditional max. likelihood

nboot

number of bootstrap samples

rseed

random-number seed

verbose

produce verbose output?

fuzz

small value for keeping estimated frequencies away from 0/1

maxfail

number of consecutive fitting tries before entering NAs for a given simulation

pb

(logical) draw progress bar?

start.type

starting conditions for fitting procedure (see startvec and/or startvec0)

param

Do parametric bootstrapping?

param.match

match mean or mode of resampled frequencies?

ndepfac

scaling factor for CML fit

save.boot

save bootstrap replicates?

print.boot

verbose output from bootstrap?

...

additional arguments to cml

Value

An object of type mixstock.est with element resample as a matrix of bootstrap results (where the columns are the parameters, the negative log-likelihood of the fit, and a code for convergence).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  data(simex)
  x <- genboot(simex,method="cml",nboot=100)
  r <- x$resample
  r.ok <- r[!is.na(r[,"Convergence"]) & r[,"Convergence"]==0,]
  old.par <- par(no.readonly=TRUE)
  par(mfrow=c(2,2))
  hist(r.ok[,1],main="Contrib. A")
  hist(r.ok[,2],main="Contrib. B")
  hist(r.ok[,3],main="Neg. log likelihoods")
  plot(r.ok[,1],r.ok[,3],
        xlab="Contrib. A",ylab="NLL")
  par(old.par)

mixstock documentation built on May 2, 2019, 6:48 p.m.