# Biased urn problem & Wallenius' noncentral hypergeometric distribution

**URL:** <https://discourse.mc-stan.org/t/biased-urn-problem-wallenius-noncentral-hypergeometric-distribution/21461>\
**Category:** General\
**Created:** [March 24, 2021, 8:49am UTC](https://discourse.mc-stan.org/t/biased-urn-problem-wallenius-noncentral-hypergeometric-distribution/21461 "2021-03-24T08:49:12Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![spinkney](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@spinkney](https://discourse.mc-stan.org/u/spinkney)\
**Post date:** [December 13, 2023, 12:57pm UTC](https://discourse.mc-stan.org/t/biased-urn-problem-wallenius-noncentral-hypergeometric-distribution/21461/20 "2023-12-13T12:57:00Z")

</div>

> [@mathDR](#):
>
> I would like to apply analytical gradients to help speed things up, but don’t have the best handle on the c++ templating. Is this something you are familiar with?

I can help with this.

To help get started with adding the cpp code and gradients check out

- [Gamma distribution quantile and inverse quantile function - #37 by andrjohns](https://discourse.mc-stan.org/t/gamma-distribution-quantile-and-inverse-quantile-function/22882/37)
- [Hoping for some guidance / help with implementing custom log likelihood and gradient for research project (details below) - #14 by rok\_cesnovar](https://discourse.mc-stan.org/t/hoping-for-some-guidance-help-with-implementing-custom-log-likelihood-and-gradient-for-research-project-details-below/24598/14)
- [Vector-valued functions with manual gradients in external C++ - #3 by stevebronder](https://discourse.mc-stan.org/t/vector-valued-functions-with-manual-gradients-in-external-c/32297/3)

---

_[View the full topic](https://discourse.mc-stan.org/t/biased-urn-problem-wallenius-noncentral-hypergeometric-distribution/21461)._
