tfr.diagnose {bayesTFR} | R Documentation |

## Convergence Diagnostics of TFR Markov Chain Monte Carlo

### Description

Functions `tfr.diagnose`

and `tfr3.diagnose`

run convergence diagnostics of existing TFR MCMCs for phase II and phase III, respectively, using the `raftery.diag`

function from the coda package. `has.mcmc.converged`

checks if the existing diagnostics converged.

### Usage

```
tfr.diagnose(sim.dir, thin = 80, burnin = 2000, express = FALSE,
country.sampling.prop = NULL, keep.thin.mcmc=FALSE, verbose = TRUE)
tfr3.diagnose(sim.dir, thin = 60, burnin = 10000, express = TRUE,
country.sampling.prop = NULL, verbose = TRUE, ...)
has.mcmc.converged(diag)
```

### Arguments

`sim.dir` |
Directory with the MCMC simulation results. |

`thin` |
Thinning interval. |

`burnin` |
Number of iterations to be discarded from the beginning of the parameter traces. |

`express` |
Logical. If |

`country.sampling.prop` |
Proportion of countries that are included in the diagnostics. If it is |

`keep.thin.mcmc` |
Logical. If |

`verbose` |
Logical switching log messages on and off. |

`diag` |
Object of class |

`...` |
Not used. |

### Details

The diagnose functions invoke the `tfr.raftery.diag`

(or `tfr3.raftery.diag`

) function separately for country-independent parameters and for country-specific parameters. It results in two possible states: red, i.e. it did not converge, and green, i.e. it converged.
The resulting object from `tfr.diagnose`

is stored in

‘{sim.dir}/diagnostics/bayesTFR.convergence_{thin}_{burnin}.rda’ and can be accessed using the function `get.tfr.convergence`

. Function `tfr3.diagnose`

stores its result into

‘{sim.dir}/phaseIII/diagnostics/bayesTFR.convergence_{thin}_{burnin}.rda’ which can be accessed via `get.tfr3.convergence`

.

### Value

`has.mcmc.converged`

returns a logical value determining if there is convergence or not.

`tfr.diagnose`

and `tfr3.diagnose`

return an object of class `bayesTFR.convergence`

with components:

`result` |
Table containing all not-converged parameters. Its columns include ‘Total iterations needed’ and ‘Remaining iterations’. |

`lresult.country.independent` |
Number of rows in |

`country.independent` |
Result of |

`country.specific` |
Result of |

`iter.needed` |
Number of additional iterations suggested in order to achieve convergence. |

`iter.total` |
Total number of iterations of the original unthinned set of chains. |

`use.nr.traj` |
Suggestion for number of trajectories in generating predictions. |

`burnin` |
Burnin used. |

`thin` |
Thinning interval used. |

`status` |
Vector of character strings containing the result status. Possible values: ‘green’, ‘red’. |

`mcmc.set` |
Object of class |

`thin.mcmc` |
If |

`express` |
Value of the input argument |

`nr.countries` |
Vector with elements |

### Author(s)

Hana Sevcikova, Leontine Alkema, Adrian Raftery

### See Also

`tfr.raftery.diag`

, `raftery.diag`

, `summary.bayesTFR.convergence`

, `get.tfr.convergence`

, `create.thinned.tfr.mcmc`

*bayesTFR*version 7.4-2 Index]