First release: a rewrite of the archived 'IMIS' package (Raftery and Bao).
- All computations are on the log scale:
imis()takeslog_likelihood()andlog_prior(), and importance weights, mixture densities and the marginal likelihood are computed with log-sum-exp. Very small likelihoods (e.g.exp(-5000)) no longer underflow. n_centersadds several normal components per iteration, spread over separate high-weight regions.sampling = "mixture"draws each iteration from the whole current mixture (prior plus all normal components), as in Steele, Raftery and Emond (2006). The default,"incremental", draws from the newest components, as in Raftery and Bao (2010). Draws are always weighted against the full mixture using the realized number of draws per component.- The optimization stage (
n_optim, "IMIS-opt") works on the log-posterior, copes with points where the posterior is zero, falls back gracefully when BFGS or the Hessian fails, and excludes draws near each mode using that mode's covariance, as described in Raftery and Bao (2010). - The likelihood is not evaluated where the prior density is zero, and such draws get an importance weight of zero.
parallel = TRUEevaluates the likelihood in parallel with 'future.apply', in blocks of draws; the backend is chosen withfuture::plan().catch_errors = TRUEgives a log-likelihood of-Infto parameter sets for which the model fails, instead of stopping.- Default sample sizes follow Raftery and Bao (2010):
n_initial = 1000 * dandn_per_component = 100 * d. - The marginal likelihood comes with a standard error (Raftery and Bao, 2010, eq. 7).
imis()returns animisobject withprint(),summary()(importance-weighted posterior summaries),plot()(diagnostics, prior vs posterior marginals, pairs),as.matrix()andas.data.frame()methods.bayes_factor()compares two models fitted withimis().initial_drawsandinitial_log_likstartimis()from an existing sample of the prior, such as a Latin hypercube sample from an earlier random search, and its log-likelihoods, without running the model again for those parameter sets (#1).imis_legacy()is a drop-in replacement forIMIS::IMIS().vectorized/vectorized_priorlet the log-likelihood and log-prior be written either for a matrix of parameter sets or for one parameter vector.- Example models
sick_sicker_markov()andcrs_markov(), with calibration targetssick_sicker_targetsandcrs_targets.