Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posterior_epred following stan_polr is not an expectation #578

Open
bgoodri opened this issue Nov 9, 2022 · 0 comments
Open

posterior_epred following stan_polr is not an expectation #578

bgoodri opened this issue Nov 9, 2022 · 0 comments

Comments

@bgoodri
Copy link
Contributor

bgoodri commented Nov 9, 2022

Summary:

posterior_epred(stan_polr(...)) yields a $S \times N$ matrix of numbers between $0$ and $1$ that are not the expectation of anything

Description:

This was an unanticipated but anticipatable consequence of introducing posterior_epred as an alias for posterior_linpred(*, transform = TRUE). In the case of an ordinal model estimated by stan_polr, calling posterior_linpred(*, transform = TRUE) did not make sense (with more than two categories), but at least it was somewhat clear that it was applying a transformation (such as plogis, pnorm, etc.) to the linear predictor. With posterior_epred, it still does not make sense (with more than two categories) and is not at all clear that the result is not the expectation of the outcome, which does not really exist unless you reconceptualize the outcome as a one-hot vector of size $J$ in which case its expectation is a simplex.

We should probably throw an error in this case (unless there are only two categories) or else return a $S \times N \times J$ array

Reproducible Steps:

library(rstanarm)
example(stan_polr) # creates fit
str(posterior_epred(fit))

RStanARM Version:

2.21.1 but applies to several versions before that

R Version:

Doesn't matter

Operating System:

Doesn't matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant