来自 zelig 包 (R) 的 texreg-ing Tobit 输出

texreg-ing Tobit output from zelig package (R)

这是一个奇怪的问题,但这里是:

我正在尝试将我的模型结果输出到带有 texreg 的 TeX table。

reg <- zelig(Y ~ X, model = "tobit", below = 0, above = Inf)

但是,我从 texreg 收到错误消息:

texreg(reg)

Error in .local(model, ...) : Only the following Zelig models are currently supported: logit, ls, mlogit, ologit, probit, relogit.

我的问题基本上是:这是 Zelig 还是 texreg 的错误?

2015-07-20 更新:

extract.zelig 现在有一个 tobit 方法 (Zelig_4.2-1)

所以 texreg(reg) 现在可以正常工作了。无论如何,我会把下面的内容留给后代。


确定了问题的根源后,我更新了 extract.zelig 方法并将其传递给软件包 creator/maintainer Philip Leifield,他将其纳入了最新的 R-Forge 版本(可通过 install.packages("texreg", repos="http://R-Forge.R-project.org")).我不确定它是否在当前的 CRAN 版本中 (2015-04-07)...

这是我们需要添加的内容:

else if ("tobit" %in% class(model)) {
        coefficient.names <- rownames(s$table)
        coefficients <- s$table[, 1]
        standard.errors <- s$table[, 2]
        significance <- s$table[, 5]
        gof <- numeric()
        gof.names <- character()
        gof.decimal <- logical()
        if (include.aic == TRUE) {
            aic <- AIC(model)
            gof <- c(gof, aic)
            gof.names <- c(gof.names, "AIC")
            gof.decimal <- c(gof.decimal, TRUE)
        }
        if (include.bic == TRUE) {
            bic <- BIC(model)
            gof <- c(gof, bic)
            gof.names <- c(gof.names, "BIC")
            gof.decimal <- c(gof.decimal, TRUE)
        }
        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.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)
    }