R/phi-priors.R

Defines functions discrete_gamma

#' @importFrom stats dgamma
discrete_gamma <- function(using_terms, max_size=10, shape=10, rate=4) {
	n_terms <- length(using_terms)
	dist <- dgamma(seq(max_size), shape=shape, rate=rate)
	dens <- log(dist/sum(dist))

	function(phi) {
		x <- length(phi)
		if (x > max_size) -Inf
		else dens[x] - lchoose(n_terms, x)
	}
}

Try the SimReg package in your browser

Any scripts or data that you put into this service are public.

SimReg documentation built on Feb. 15, 2021, 5:10 p.m.