Description Usage Arguments Details Value Author(s) References Examples

A simple example based on estimating the parameters of a linear regression model using

* Data annealing sequential Monte Carlo (`LinReg`

).

* Likelihood annealing sequential Monte Carlo (`LinRegLA`

).

* Likelihood annealing sequential Monte Carlo with the temperature schedule,
number of MCMC repeats and random walk covariance matrices adapted online (`LinRegLA_adapt`

).

1 2 3 4 5 |

`model` |
Choice of regression model (1 for density as the predictor and 2 for adjusted density as the predictor). |

`particles` |
An integer specifying the number of particles. |

`plot` |
A boolean variable to determine whether to plot the posterior estimates. |

`temperatures` |
In likelihood annealing SMC the targets are defined as |

`resampTol` |
The adaptive implementation of likelihood annealing SMC allows for the resampling tolerance to be specified. This parameter can be set to a value in the range [0,1) corresponding to a fraction of the size of the particle set or it may be set to an integer corresponding to an actual effective sample size. |

`tempTol` |
A tolerance for adaptive choice of the temperature schedule such that the conditional ESS is maintained at tempTol*particles. |

Williams (1959) considers two competing linear regression models for the maximum compression strength parallel to the grain for radiata pine. Both models are of the form

*y_i = α + β (x_i - \bar{x}) + ε_i*,

where *ε_i ~ N(0,σ^2)* and *i=1,…,42*.
Here *y* is the maximum compression strength in pounds per square
inch. The density (in pounds per cubic foot) of the radiata pine
is considered a useful predictor, so model 1 uses density for *x*.
Model 2 instead considers the density adjusted for resin content, which
is associated with high density but not with strength.

This example is frequently used as a test problem in model choice
(see for example Carlin and Chib (1995) and Friel and Pettitt (2008)).
We use the standard uninformative normal and inverse gamma priors for this example
along with the transformation *φ=log(σ^2)* so that all parameters
are on the real line and *θ = [α,β,φ]*.
The evidence can be computed using numerical estimation
for both of the competing models. The log evidence is -309.9 for model 1 and
-301.4 for model 2.

The `LinReg`

function implements a data annealing approach to this example.

The `LinRegLA`

function implements a likelihood annealing approach to this example.

The `LinRegLA_adapt`

function implements a likelihood annealing approach to this example
with adaptation of the temperature schedule, number of MCMC repeats and random walk covariance
matrices.

The `LinReg`

function returns a `list`

containing the final particle
approximation to the target (*θ* and the corresponding weights) as well as the logarithm
of the estimated model evidence.

The `LinRegLA`

function returns a `list`

containing the population
of particles and their associates log likelihoods, log priors and weights at each iteration. The
effective sample size at each of the iterations and several different
estimates of the logarithm of the model evidence are also returned.

The `LinRegLA_adapt`

function returns a `list`

containing all of the same
output as `LinRegLA`

, in addition to the adaptively chosen temperature schedule
and number of MCMC repeats.

Adam M. Johansen, Dirk Eddelbuettel and Leah F. South

B. P. Carlin and S. Chib. Bayesian model choice via Markov chain Monte Carlo. Journal of the Royal Statistical Society: Series B (Statistical Methodology). 57(3):473-484, 1995.

N. Friel and A. N. Pettitt. Marginal likelihood estimation via power posteriors. Journal of the Royal Statistical Society: Series B (Statistical Methodology). 70(3):589-607, 2008.

Williams, E. (1959). Regression analysis. Wiley.

1 2 3 4 5 | ```
res <- LinReg(model=1, particles=1000, plot=TRUE)
res <- LinRegLA(model=1, particles=1000)
res <- LinRegLA_adapt(model=1, particles=1000)
``` |

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.