gibbsC {mixstock} | R Documentation

## Run mixed stock analysis Gibbs sampler, in C

### Description

Runs a Gibbs sampler MCMC for mixed stock analysis, calling a routine written in C (for code). Low-level function, called by other functions.

### Usage

    gibbsC(a=1, startiter, maxiter, data, mixsamp=NULL, sourcesamp=NULL,
    startfval=NULL, thin=1, fprior=NULL, outfile=FALSE,
    outfn="mixstock-gibbs", randseed=1001, rptiter=-1, debug=FALSE,
    contrun=FALSE,contrib.start=NULL,sourcefreq.start=NULL)

### Arguments

`a` | Prior strength parameter
`startiter` | Number of iterations to discard (burn-in)
`maxiter` | Total number of chain steps
`data` | A `mixstock.data` object
`mixsamp` | Marker sample from mixed populations
`sourcesamp` | Marker samples from sources
`startfval` | Where to start the chain: 0=
`thin` | thinning factor
`fprior` | Bayesian prior
`outfile` | send data to an output file?
`outfn` | name of output file
`randseed` | random-number seed
`rptiter` | frequency for sending reports to screen
`debug` | debug?
`contrun` | continuation run? set fval and sourcefreq directly
`contrib.start` | vector of starting contributions
`sourcefreq.start` | matrix of starting source freqs

### Value

a numeric matrix containing samples from the chain: each row is a vector of estimated contribution frequencies from each rookery

### Note

gibbsC calls C code to generate multinomial deviates derived from the randlib.c library (version 1.3: http://odin.mdacc.tmc.edu/anonftp/), written by Barry W. Brown, James Lovato, Kathy Russell, and John Venier, derived in turn from page 559 of: Devroye, Luc, Non-Uniform Random Variate Generation. Springer-Verlag, New York, 1986.

### Author(s)

Ben Bolker

[Package mixstock version 0.9.2 Index]