# Stepping stone estimation of the marginal likelihood for a bayou model

### Description

Estimates the marginal likelihood of a bayou model by generating mcmc chains for power posteriors for a series of steps from 0 to 1, progressing from a reference distribution to the posterior distribution.

### Usage

1 2 3 |

### Arguments

`Bk` |
A vector sequence from 0 to 1 that gives the exponents of the power posterior distribution to take from the reference distribution to the reference distribution. (See details) |

`chain` |
A mcmc chain used to generate the reference distribution (see |

`tree` |
A phylogenetic tree of class "phylo" |

`dat` |
A named vector of continuous trait data |

`SE` |
A vector giving the standard error of the trait data. If a single number is given, standard errors are assumed to be constant across the phylogeny. |

`prior` |
The prior function used to generate the mcmc chain. |

`startpar` |
The starting parameter values to be used. If any parameters are set as "fixed", this should be specified. If |

`burnin` |
The initial proportion of the provided mcmc chain to be discarded when generating the reference function |

`ngen` |
The number of mcmc generations to be run for each step of the stepping stone alogrithm. |

`powerposteriorFn` |
The power posterior function to be used. If |

`parallel` |
A logical indicating whether or not the chains should be run in parallel. |

`...` |
Other parameters passed to the mcmc algorithm, see |

### Details

This function estimates the marginal likelihood of a bayou model by using stepping stone estimation from a reference distribution to the posterior
distribution using the method of Fan et al. (2011). The vector `Bk`

provides a sequence from 0 to 1. The length of this sequence determines the number
of mcmc chains that will be run, and the values are used as the exponents of the power posterior function, stepping from purely the reference distribution (k=0)
to purely the posterior distribution (k=1). These chains can be run in parallel if `parallel`

is set to `TRUE`

. The number of cores available is determined
by a call to `detectCores`

, and can be set by .... Note that when run in parallel, progress within each
of the individual mcmc chains will not be reported, and if `ngen`

is high, it may take a considerable amount of time to run. Furthermore, if many samples
are saved from each mcmc run, and a number of steps along `Bk`

is large, the returned object may require a substantial amount of memory.

### Value

A list of class "ssMCMC" that provides the log marginal likelihood `lnr`

, a list of the individual normalizing constants estimated at each step `lnrk`

,
a list of the mcmc chains used for importance sampling to estimating the marginal likelihood at each step `chains`

, and mcmc fit data from each of the runs `fits`

.
Note that this object may become quite large if a number of chains are run for many generations. To reduce the number of samples taken, increase the parameter `samp`

(default = 10)
which sets the frequency at which samples are saved in the mcmc chain.