mixstock.boot: Bootstrap samples of mixed stock analysis data

Description Usage Arguments Details Value Author(s) Examples

View source: R/mixstock.R

Description

Create a bootstrap (multinomial) sample from a given set of marker data (source and mixed population genotypes), either parametric or non-parametric

Usage

1
2
mixstock.boot(x, param=FALSE, condense=TRUE,save.freq=FALSE,
param.match="mean")

Arguments

x

"Standard" mixstock data, a list with mixsamp (vector of samples in the mixed population) and sourcesamp (matrix of samples in the sources, rows=markers, columns=sources)

param

parametric bootstrapping or not?

condense

use markfreq.condense on the results?

save.freq

save frequencies?

param.match

match mean or mode of distribution when parametric bootstrapping?

Details

Nonparametric bootstrapping just resamples the observed data from the mixed population and from each source with replacement; this is equivalent to taking a multinomial sample with the probabilities equal to the observed sample frequencies. Parametric bootstrapping takes the observed samples and resamples the probabilities themselves from a Dirichlet distribution, then takes a multinomial sample.

Value

A bootstrapped data set, in the same format as the input data: i.e.,

mixsamp

samples in mixed population

sourcesamp

samples in sources

...

Author(s)

Ben Bolker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
true.freq <- matrix(c(0.65,0.33,0.01,0.01,
                       0.33,0.65,0.01,0.01),ncol=2)
true.contrib <- c(0.9,0.1)
x <- simmixstock0(true.freq,true.contrib,50,100,1004)
nboot <- 1000
boot.results.par <- matrix(NA,ncol=12,nrow=nboot)
boot.results.npar <- matrix(NA,ncol=12,nrow=nboot)
for (i in 1:nboot) {
  x.par  <- mixstock.boot(x,param=TRUE,condense=FALSE)
  x.npar <- mixstock.boot(x,condense=FALSE)
  boot.results.par[i,] <- c(x.par$sourcesamp,x.par$mixsamp)
  boot.results.npar[i,] <- c(x.npar$sourcesamp,x.npar$mixsamp)
}
summary(boot.results.par[,7:8])
summary(boot.results.npar[,7:8])
par(mfrow=c(1,2))
hist(boot.results.par[,7])
hist(boot.results.npar[,7])

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