I have estimated a nested logit using the command mlogit() from the R package mlogit. The output is in the form of a list with 17 elements. If I run summary() on the output, I get a table with the estimated coefficients and their respective standard errors. However, I cannot find such standard errors in the output of the mlogit() command (the list with 17 elements). Am I missing where it is? Below I provide a non-reproducible example of the kind of code I am running, as well as the list of elements in the output.
My guess is that maybe the command summary() is somehow calculating the standard errors for the estimated coefficients. Given the coefficients are estimated by mlogit() using Maximum Likelihood, I am guessing these standard errors come from calculating the inverse of the Fischer information matrix. However, I am unsure how to do so given the output I have from the mlogit() command. I will be thankful if anyone could help me with this.
Thanks in advance for your help!
CODE EXAMPLE:
library(dfidx)
library(mlogit)
ml_data <- data %>% dfidx(idx = c("id", "alternative"))
model_output <- mlogit(choice ~ regresor1 + regresor2,
data = ml_data,
reflevel = "alt1",
nests = list(nest1 = c("alt2", "alt3", "alt4"),
nest2 = c("alt1")),
un.nest.el = FALSE, constPar = c("iv:nest2" = 1))
summary(model_output)
OUTPUT FROM mlogit():
More information available here: Rdocumentation (though my list has 17 elements and the documentation only describes 13 of them)
Your example isn't reproducible, but we can run the example from
?mlogit:This results in
Notice that the class of the
modelobject is"mlogit":In R, the
summaryfunction is an S3 generic, and when we callsummary(model), it actually calls themlogit:::summary.mlogitfunction:This doesn't simply print a summary to the screen - it actually does further calculations that produce an object of class
"summary.mlogit". We can see this by storing the object and examining it:We will see that it contains different data members than
modeldoes:One of these, the member
CoefTableis the data table printed in the summary:If we don't want to look through all the members of an object to find the summary table, we can always just try the generic S3
coef, to see if the authors have defined a method. It turns out they have:It seems that this is what you are looking for. However, you mention a variance-covariance matrix in your question, which is a different concept from the coefficient table. If you genuinely want the variance-covariance matrix, there is a
vcovmethod that you can use on your model too:Created on 2023-07-07 with reprex v2.0.2