LaTex Summary Table Options for Zelig MLogit Results

I've been trying to extract my summary stats from an mlogit model run through Zelig using texreg, stargazer and memisc.

texreg throws me the following error:

texreg(MLogitRes3)
Error in (function (classes, fdef, mtable)  : unable to find an     
inherited method for function ‘extract’ for signature ‘"vglm"’

stargazer throws me the following error:

stargazer(MLogitRes3)
Error in objects[[i]]$zelig.call : 
$ operator not defined for this S4 class

memisc (using the mtable function) throws me this final error:

mtable(MLogitRes3)
Error in UseMethod("getSummary") : 
no applicable method for 'getSummary' applied to an object of class
"c('vglm',  'vlm', 'vlmsmall')"

Do none of these packages support mlogit choice models within zelig? Do I have options to export my summary stats into a table usable in LaTex elsewhere?

Upvotes: 0

Views: 568

Answers (1)

MichaelChirico
MichaelChirico

Reputation: 34703

Have you tried to reproduce this recently? I just checked out the code for texreg::extract.zelig and it appears to have a method for mlogit:

function (model, include.aic = TRUE, include.bic = TRUE, include.loglik = TRUE, 
    include.deviance = TRUE, include.nobs = TRUE, include.rsquared = TRUE, 
    include.adjrs = TRUE, include.fstatistic = TRUE, ...) 
    ...
    else if ("mlogit" %in% class(model)) {
        coefficient.names <- rownames(s@coef3)
        coefficients <- s@coef3[, 1]
        standard.errors <- s@coef3[, 2]
        zval <- s@coef3[, 3]
        significance <- 2 * pnorm(abs(zval), lower.tail = FALSE)
        gof <- numeric()
        gof.names <- character()
        gof.decimal <- logical()
        if (include.loglik == TRUE) {
            lik <- logLik(model)[1]
            gof <- c(gof, lik)
            gof.names <- c(gof.names, "Log Likelihood")
            gof.decimal <- c(gof.decimal, TRUE)
        }
        if (include.deviance == TRUE) {
            dev <- deviance(s)
            if (!is.null(dev)) {
                gof <- c(gof, dev)
                gof.names <- c(gof.names, "Deviance")
                gof.decimal <- c(gof.decimal, TRUE)
            }
        }
        if (include.nobs == TRUE) {
            n <- nrow(model$data)
            gof <- c(gof, n)
            gof.names <- c(gof.names, "Num. obs.")
            gof.decimal <- c(gof.decimal, FALSE)
        }
        tr <- createTexreg(coef.names = coefficient.names, coef = coefficients, 
            se = standard.errors, pvalues = significance, gof.names = gof.names, 
            gof = gof, gof.decimal = gof.decimal)
        return(tr)
    }
    ...
}

Anyway, if you're still having trouble, you may want to read Section 6 of the texreg article which gives you instructions for how to define your own extract method for any model, and/or write the package author (Philip Leifeld) to get support added.

Upvotes: 1

Related Questions