1

I'm currently running multinomial logistic regressions with R using nnet package; multinom function. I have 16 IV and one DV. Using the tbl_regression function i can get the contribution of each DV to my model (odds ration; CI; p value), but I can't find the following statistics for the overall model: –2 Log Likelihood; χ2 ; df , P value; pseudo-R² ; proportional chance criteria; model accuracy rate.

Where can i find these statistics ? What syntax do i need ?

Thank you very much!

I tried to look online but i can't find this information.

  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 10 '23 at 14:08

1 Answers1

0

multinom doesn't calculate many goodness of fit or inferential statistics, but you can obtain the statistics you are interested in using other functions. I'll demonstrate using the iris data.

Set up and run the model:

data(iris)
library(nnet)

# iris has a "Species" variable that we can use as our nominal dependent variable
fit <- multinom(
    Species ~ Sepal.Width + Sepal.Length,
    data = iris
)

Inferential statistics

Calling summary on the model object will give you standard errors, from which you can calculate z-scores and p-values:

# see the standard errors
summary(fit)$standard.errors

# calculate z-scores
z <- summary(fit)$coefficients/summary(fit)$standard.errors

# calculate p-values
p <- (1 - pnorm(abs(z), 0, 1)) * 2

Goodness of Fit and Model Selection

Moving on to most of the other statistics you mentioned:

# get the log likelihood
logLik(fit) 
# this is a base R function. It also includes the df.

# pseudo r-squared
pscl::pR2(fit)
# pR2, from the pscl package, returns a variety of pseudo r-squared statistics.

# Chi-squared test of model fit
# This is a likelihood ratio test comparing the full model to a null model.

# First, fit the null model
null <- multinom(Species ~ 1, data = iris)

# Then, calculate the test statistic
2 * (logLik(fit) - logLik(null))

Other notes

I'm trained in maximum likelihood estimation for use with the general linear model, but I'm not familiar with the proportional chance criteria or model accuracy rate, so maybe these are discipline specific terms that I'm just not familiar with. If you can provide more information about what these statistics are, I can try to help you calculate them.

As a final note, you do also have the option of fitting the model using mlogit from the mlogit package. mlogitis nicer for use in summary tables using something like stargazer and has a more traditional output when you use summary on the model object. I didn't use it here because you started your question with multinom, but it's worth checking out if you haven't already. If you do use it, pay attention to the format it expects your data to be in, because it requires a small transformation from the usual long, tidy format that is most common.

Reed Merrill
  • 117
  • 1
  • 10