This function generates a reference function from a mcmc chain for use in marginal likelihood estimation.

1 | ```
make.refFn(chain, prior, burnin = 0.3, plot = TRUE)
``` |

`chain` |
An mcmc chain produced by |

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

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

`plot` |
Logical indicating whether or not a plot should be created |

Distributions are fit to each mcmc chain and the best-fitting distribution is chosen as
the reference distribution for that parameter using the method of Fan et al. (2011). For positive
continuous parameters `alpha, sigma^2, halflife, Vy, w2, Ne`

, Log-normal, exponential, gamma and weibull
distributions are fit. For continuous distributions `theta`

, Normal, Cauchy and Logistic distributions
are fit. For discrete distributions, `k`

, negative binomial, poisson and geometric distributions are fit.
Best-fitting distributions are determined by AIC.

Returns a reference function of class "refFn" that takes a parameter list and returns the log density
given the reference distribution. If `plot=TRUE`

, a plot is produced showing the density of variable parameters
and the fitted distribution from the reference function (in red).

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.