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. mlogit
is 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.