mcmc.chainlength.est {mixstock} | R Documentation

## Estimate appropriate chain length for mixed stock analysis by MCMC

### Description

Determines an appropriate chain length for MCMC estimation of source contributions to a mixed stock by running Raftery and Lewis and Gelman & Rubin diagnostics repeatedly until convergence criteria are met

### Usage

    mcmc.chainlength.est(x, mult=1, inflate=sqrt(2), GR.crit=1.2,
    nchains=x$R, verbose=FALSE)

### Arguments

`x` | Mixed stock analysis data (a `mixstock.data` object or a list containing `sourcesamp` and `mixsamp`
`mult` | How many different times to run tests
`inflate` | How much to increase chain length at every failed iteration of Gelman and Rubin
`GR.crit` | Maximum value for Gelman and Rubin 97.5% quantile in order to declare convergence
`nchains` | number of separate MCMC chains to run
`verbose` | print lots of detail while running?

### Details

If `mult` is 1, runs Raftery and Lewis diagnostics on a chain starting from equal contributions; if `mult` is greater than 1, runs them on as many chains as there are sourcees, each starting from a 95% contribution from that source. Iteratively increases each chain length to that suggested by the R&L diagnostic, until all chains pass. Then runs Gelman and Rubin on a set of chains starting from each source. If `mult` is greater than 1, it does each step on `mult` different chains and takes the maximum.

### Value

The maximum chainlength needed to get convergence in all tests

### Author(s)

Ben Bolker

### See Also

gibbsC

### Examples

    data(simex)
    mcmc.chainlength.est(simex,verbose=TRUE)

[Package mixstock version 0.9.2 Index]