我一直在尝试使用mlogit
,Zelig
和texreg
从stargazer
模型中提取我的摘要统计信息。
memisc
引发了以下错误:
texreg
texreg(MLogitRes3)
Error in (function (classes, fdef, mtable) : unable to find an
inherited method for function ‘extract’ for signature ‘"vglm"’
引发了以下错误:
stargazer
stargazer(MLogitRes3)
Error in objects[[i]]$zelig.call :
$ operator not defined for this S4 class
(使用memisc
函数)抛出了最后一个错误:
mtable
这些软件包中是否都不支持mtable(MLogitRes3)
Error in UseMethod("getSummary") :
no applicable method for 'getSummary' applied to an object of class
"c('vglm', 'vlm', 'vlmsmall')"
中的mlogit
个选择模型?我是否可以选择将我的摘要统计信息导出到LaTex其他地方可用的表中?
答案 0 :(得分:1)
你最近有没有尝试重现这个?我刚查看了texreg::extract.zelig
的代码,它似乎有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)
}
...
}
无论如何,如果您仍然遇到问题,可能需要阅读Section 6 of the texreg
article,其中提供了有关如何为任何模型定义自己的extract
方法和/或编写软件包作者的说明(Philip Leifeld)获得支持。