log_mix on the logit scale
Open
@rtrangucci is already working on this.
Since Jul 6, 2015.
feature
new function
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
From @bob-carpenter on February 3, 2015 18:31
Now that we have log_mix defined on the natural probability scale:
log_mix(theta, lp1, lp2)
= log(theta * exp(lp1) + (1 - theta) * exp(lp2))
= log_sum_exp(log(theta * exp(lp1)), log((1 - theta) * exp(lp2))
= log_sum_exp(log(theta) + lp1, log(1-theta) + lp2)
it'd be nice to roll in the link function (inv_logit) and just work on the unconstrained log-odds scale with
log_mix_logit(alpha, lp1, lp2)
= log_mix(inv_logit(alpha), lp1, lp2)
= log_sum_exp(log(inv_logit(alpha) + lp1, log(1 - inv_logit(theta)) + lp2)
Special functions log_inv_logit and log1m_inv_logit already exist.
Copied from original issue: stan-dev/stan#1260
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.