Can multiple outcomes be regressed on the same linear model?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 12/100
Research direction
This is a modeling question, not a code change. The snippet calls ulam with a Poisson likelihood and indexed intercepts and slopes, and it refers to the book's multinomial-as-Poisson decomposition. Start by checking whether the book or package docs already cover indexed multi-category Poisson models, and whether the snippet's indexing is valid. Done means a maintainer-confirmed answer, or a documentation note that addresses the K-category case.
Written by the indexing model from the issue text.
Description
From your book, you mention that a multinomial can be decomposed into several Poisson regression, where each output category gets its own linear model. Say that, instead of 2-3 category outcomes, there are many more (e.g., K=100). Is there a way to regress K-1 outcome categories on the same linear model, i.e., without having to write K-1 linear models?
I'm imagining something like:
Y <- rep(c("A","B","C"), times=c(10,8,6))
Y_ind <- 1:3
x <- c(rnorm(n=10, mean=0, sd=1),
rnorm(n=8, mean=2, sd=1),
rnorm(n=6, mean=5, sd=1))
one_hot <- model.matrix(~ Y - 1)
Y_counts <- colSums(one_hot)
m <- ulam(
alist(
Y_counts[Y_ind] <- dpois(lambda[Y_ind]),
log(lambda[Y_ind]) <- a[Y_ind] + b[Y_ind]*x,
a[Y_ind] ~ dnorm(0,1),
b[Y_ind] ~ dnorm(0,1)
), data=list(Y_counts=Y_counts, Y_ind=Y_ind)
)
- Dominant language
- R
- Stars
- 2.4k
- Forks
- 632
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rmcelreath/rethinking
-
Typo: p.381Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
rmcelreath/rethinking#482 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rmcelreath/rethinking#476 ·
-
Typo: p.302Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rmcelreath/rethinking#475 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
rmcelreath/rethinking#474 ·
-
Comma splice: p.557Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rmcelreath/rethinking#471 ·
All issues in rmcelreath/rethinking
Similar issues
-
1.7
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pharmaverse/admiral#3235 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SticsRPacks/CroPlotR#185 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day