# Cross-classified model

Following up on this earlier discussion (https://groups.google.com/forum/#!topic/stan-users/kpV7R6f9x1M), providing the syntax for cross-classified model for an intercept, if one wanted to extend the model to include slopes, would it be a simple matter of extending the use of the index, as follows:

y[n] ~ inv_logit(alpha1[state[n]] + alpha2[sex[n]] + alpha +
beta*income[n] + beta1[state[n]]*income[n] + beta2[sex[n]]);

alpha1 ~ normal(0,sigma_alpha1);
alpha2 ~ normal(0,sigma_alpha2);
sigma_alpha1 ~ …
sigma_alpha2 ~ …
alpha ~ …

beta1 ~ normal(0,sigma_beta1);
beta2 ~ normal(0,sigma_beta2);
sigma_beta1 ~ …
sigma_beta2 ~ …
beta ~ …

I couldn’t quite follow this question given the link. I don’t know what a “cross-classified model for an intercept” is.

I also don’t follow the notation where you have `y[n]` distributed as `inv_logit`, because `inv_logit` is just a function. Was that supposed to be `y[n] ~ bernoulli_logit(...)` instead?

There’s nothing wrong with the model you write here. Assuming my guess above is right, you want to code this using vectorization as

``````y ~ bernoulli_logit(alpha1[state]
+ alpha2[sex]
+ alpha
+ beta * income
+ beta1[state] .* income
+ beta2[sex]);
``````

Note the `.*` used for the elementwise multiplication.

Sorry, Bob. Sometimes, brevity is the soul not of wit, but of confusion.
You intuited my question correctly. Thanks.