# Examples for modeling selection effect, non-response?

**URL:** <https://discourse.mc-stan.org/t/examples-for-modeling-selection-effect-non-response/13019>\
**Category:** Modeling\
**Created:** [February 7, 2020, 6:58pm UTC](https://discourse.mc-stan.org/t/examples-for-modeling-selection-effect-non-response/13019 "2020-02-07T18:58:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [February 7, 2020, 7:02pm UTC](https://discourse.mc-stan.org/t/examples-for-modeling-selection-effect-non-response/13019/2 "2020-02-07T19:02:08Z")

</div>

If you search on Discourse for Heckman, there are some good threads, such as this one:

> [@Heckman selection model code + simulation](https://discourse.mc-stan.org/t/heckman-selection-model-code-simulation/4853/4):
>
> Here’s a Stan program that implements the Heckman likelihood and fits the program to fake data. It recovers the parameters well. I haven’t yet fitted it to repeated simulated datasets though. EDIT: The code below has an error in the likelihood, which @RachaelMeager caught in her post below [(link)](https://discourse.mc-stan.org/t/heckman-selection-model-code-simulation/4853/26). Follow the link for the explanation, the correct code, and an extension! The likelihood contribution for observed units below should be: log(Phi(sqrt(1 - rho^2)^(-1)\*(mu\_y2[n\_pos[n]] …

---

_[View the full topic](https://discourse.mc-stan.org/t/examples-for-modeling-selection-effect-non-response/13019)._
