# HYoergeometric distribution in stan

When including Stan code in your post it really helps if you make it as readable as possible by using Stan code chunks (stan) with clear spacing and indentation. For example, use

model {
vector[N] mu = alpha + beta * x;
y ~ normal(mu, sigma);
}


model{
vector[N] mu = alpha+beta*x;
y~normal(mu,sigma);
}

To include mathematical notation in your post put LaTeX syntax between two \$ symbols, e.g.,
p(\theta | y) \propto p(\theta) p(y | \theta).

For some reason I seem unable to post this question from my log-in at stan users forum. There is no code to included.
I am puzzled that the sampling distribution for the hyperg likelihoodin stan is “int ~ hypergeometric(int, int, int)”. Since the calculation of the hyperg in log space transforms the integer quantities to log space (presumably using lgamma(x), it would seem that it should be able to handle reals (e.g., 100.0, in lieu of 100). The binomial for the basic Lincoln-Peterson mark-recapture model R~ binomial (C, M/N), where N is the unknown and is coded a a real in parameters (Stan ref manual section 15.3, pp. 216-17), I fail to see why the hyperg can’t do the same.

satn user nickg1

It is coded to only accept integer arguments to prevent mistakes when someone tries to input pi or something like that. If you know what you are doing, you can increment target yourself with three calls to lchoose`, which accepts real numbers.

Much thanks again, though I’m not convinced that the possibility of such an error occurring in a reasonable use of the hyperg distribution is sufficient justification for not allowing reals. Regardless, I’ll puzzle over the three calls to lchoose.