Description Usage Arguments Details Value Author(s) References

This function implements the Metropolis-Hastings algorithm using repeated calls to R-INLA to fint conditional model on the current state of the MCMC simulations.

1 2 |

`d` |
Data.frame with the data used to fit the model with R-INLA. |

`fit.inla` |
A function used to fit the model with R-INLA. It should take at least two arguments: a data.frame (first) and an object with the actual value of the sampled parameters. This function must return a vector of two components: model.sim (an 'inla' object with the fitted model) and 'mlik' (the marginal likelihood as returned by INLA in model.sim$mlik). |

`b.init` |
Initial values of the model parameters for the Metropolis-Hastings algorithm. |

`rq` |
Sampling from the proposal distribution. It must take one argument: the current state of the Markov chain. |

`dq` |
Density of the proposal distribution. It takes two arguments: current state and proposed new state. |

`prior` |
Prior distribution of the model parameters. |

`n.sim` |
Total of simulations to be done. |

`n.burnin` |
Number of burn-in simulation (thinning is ignored here). |

`n.thin` |
Thinning to be applied to the simulations after burn-in. |

`n.errors` |
This is the number of errores allowed when calling inla(). |

`verbose` |
Whether to show some running information or not (defaut to FALSE). |

This function implements the Metropolis-Hastings algorithm using INLA (i.e., INLA within MCMC) at every step. In practice, only a few of the model parameters are sampled in the MCMC steps and the posterior marginal of the remainder of parameters is obtained by Bayesian model averaging of the conditional marginals returned by R-INLA at each step of the Metropolis-Hastings algorithm.

A list with three components:

`acc.sim` |
A vector of logical values (of length 'n.sim') showing whether a given proposal has been accepted or not. This is useful to compute the acceptance rate. |

`model.sim` |
A list with the models fitted, as returned by fit.inla(). |

`b.sim` |
List of all sampled values of the models parameters. It is a list beacuse the sampled values can be vectors. |

Virgilio G<f3>mez-Rubio.

Virgilio G<f3>mez-Rubio and H<e5>vard Rue (2017). Markov Chain Monte Carlo with the Integrated Nested Laplace Approximation. https://arxiv.org/abs/1210.4908.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.