Fitted values for multinom in R: Coefficients for Reference Category?

笑着哭i 提交于 2019-12-04 15:13:26
Gabriela

I had the same question, and after looking around I think the solution is: given 3 classes: a,b,c and the fitted(model) probabilities pa,pb,pc output by the algorithm, you can reconstruct those probabilities from these 3 equations:

log(pb/pa) = beta1*X

log(pc/pa) = beta2*X

pa+pb+pc=1

Where beta1,beta2 are the rows of the output of coef(model), and X is your input data.

Playing with those equations you get to:

pb = exp(beta1*X)/(1+exp(beta1*X)+exp(beta2*X))

pc = exp(beta2*X)/(1+exp(beta1*X)+exp(beta2*X))

pa = 1 - pb - pc
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!