# Generalized linear latent variable model in Stan

**URL:** <https://discourse.mc-stan.org/t/generalized-linear-latent-variable-model-in-stan/2124>\
**Category:** Modeling\
**Created:** [October 5, 2017, 2:05pm UTC](https://discourse.mc-stan.org/t/generalized-linear-latent-variable-model-in-stan/2124 "2017-10-05T14:05:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [October 5, 2017, 9:17pm UTC](https://discourse.mc-stan.org/t/generalized-linear-latent-variable-model-in-stan/2124/2 "2017-10-05T21:17:58Z")

</div>

Howdy howdy, I had a quick look at this.

`spp_intercept ~ normal( 0 , sppvar );`

The second argument to normal for a Stan model is a standard deviation, but that’d only mess up your labeling.

`matrix[N_site_id, D] latent_vars;`

These are the zs, right? Aren’t there just N\_sites of them?

The matrix uij is a function of z and lambda. Given those are both parameters, it’s probably going to be painful to sample that (from the paper “Estimation is difficult because neither the latent variables zi nor the factor loadings lj are known”). How did they get around this?

It’s probably worth your time to generate stuff from the approximate model exactly. This’ll help you isolate issues with the model (if you know exactly how data was generated – hopefully you can get it to fit). This latent variable vs. factor loadings thing seems like something worth understanding.

If that works out, then you can move to working with this model when it’s an approximation.

---

_[View the full topic](https://discourse.mc-stan.org/t/generalized-linear-latent-variable-model-in-stan/2124)._
