Open alashworth opened 5 years ago
Comment by bob-carpenter Thursday May 26, 2016 at 18:56 GMT
It will need to be implemented in stan-dev/math, at which point adding it to Stan is a a couple lines of code and some doc.
There's a categorical_logit which can be followed here.
The big speedup will be when there's a single beta vector and an array of y outcomes; then the softmax will only need to be computed once and it and the derivates can be reused. If beta and y are both arrays, it won't be much faster than a loop, because there's no underlying floating-point calculations to share.
Issue by demodw Thursday May 26, 2016 at 15:50 GMT Originally opened as https://github.com/stan-dev/stan/issues/1897
Summary:
Add a function that matches the existing
bernoulli_logit
andcategorical_logit
.Description:
This would add a convenience function usable in multi-outcome logistic regression problems. For models with larger data sets it would add a significant speedup, given that the current
multinomial
function has to be called every single iteration, since it currently only accepts a single vector.Current behavior
Assume there are N data points and K different outcomes, y is a NxK matrix of integers, beta is a K vector with some combination of covariates and predictors for each outcome,
Wanted behavior
y ~ multinomial_logit(beta)
In this case beta would be a NxK matrix with some combination of covariates and predictors for each outcome.
Additional Information:
I could not find any open issues for this missing feature. Also, I am not sure if this should be added as an issue to the stan-dev/math repository.
Current Version:
v2.9.0