Hi everyone,

I would like to fit a conditional logistc (softmax) regression model where the set of options varies over choice scenarios/strata.

In stan, the model can be coded by turning the data into long format, giving ‘start’ and ‘end’ indicators for the individual strata and utilizing the `log_softmax()`

function to compute log probabilities (see stan code below). The log likelihood is then just the sum of the log probabilites at the observed choices (credit to James Savage).

As I have a lot of data, I wanted to try how tensorflow parallelisation fares in terms of speed. However, I’m having a hard time translating the model structure to greta.

Does anyone know if/how this could be done?

All the best and thanks a lot

Jakob

PS: Here’s the stan code:

```
data {
int<lower=0> N;
int<lower=0> E;
int<lower=1> K;
vector[N] y;
matrix[N,K] x;
int<lower=1> start[E];
int<lower=1> end[E];
}
parameters {
vector[K] beta;
}
model {
vector[N] log_prob;
beta ~ normal(0, .5);
for (e in 1:E)
log_prob[start[e]:end[e]] = log_softmax(x[start[e]:end[e]] * beta);
target += log_prob' * y;
}
```