简体   繁体   中英

separating `multinom` estimations by response (nnet package) in R

In a multinomial logistic regression, one uses a set of covariates (x1, x2, ... xn) to predict the value of a discrete variable y that, for instance, can take the values of "outcome a", "outcome b", and "outcome c". In R , the most popular way to fit a multinomial logit is to use the multinom function under the nnet package.

When running model <- multinom(outcome ~ x1 + x2 + x3, data=data) , summary(model) would always present the estimations of each outcome together:

Coefficients:
               (Intercept)          x1           x2             x3 
outcome b       0.7990265   -0.9426088    0.2295875    -0.01346151
outcome c       0.6516952   -1.0174237    0.3367977    -0.43912425

My question is: how do we present statistical estimations that predict "outcome b" and "outcome c" (assuming "a" is the base category) separately?

Ideally, I would like to use stargazer() and present one coefficient table for outcome b , and another table for outcome c , any suggestions are appreciated!

Convert the Coefficients table into data frame and then delete/remove not needed rows maybe?

Like in the following example:

lmfit <- lm(mpg ~ wt + cyl, mtcars)
ab = summary(lmfit)
bc = ab$coefficients
bc = as.data.frame(bc)

wt = bc[c(-1, -3), ]
wt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM