问题描述
这是一个奇怪的问题,但是在这里:
This is a strange question, but here goes:
我正在尝试使用texreg
将模型结果输出到TeX表中.
I am trying to output my model results into a TeX table with texreg
.
reg <- zelig(Y ~ X, model = "tobit", below = 0, above = Inf)
但是,我从texreg
收到错误消息:
However, I'm getting an error from texreg
:
texreg(reg)
我的问题基本上是:这是Zelig
还是texreg
的错误?
My question is basically: is this an error from Zelig
or from texreg
?
推荐答案
更新2015-07-20:
UPDATE 2015-07-20:
extract.zelig
现在具有tobit
方法(Zelig_4.2-1
)
所以texreg(reg)
现在可以正常工作了.无论如何,我都会保留下面的内容.
So texreg(reg)
now works as expected. I'll leave the below for posterity anyway.
确定了问题的根源后,我更新了extract.zelig
方法并将其传递给软件包创建者/维护者Philip Leifield,后者将其合并到最新的R-Forge版本(可通过install.packages("texreg", repos="http://R-Forge.R-project.org")
获得).我不确定它是否在当前的CRAN版本(2015-04-07)中.
Having identified the source of the issue, I updated the extract.zelig
method and passed this along to the package creator/maintainer Philip Leifield, who incorporated into the latest R-Forge version (available via install.packages("texreg", repos="http://R-Forge.R-project.org")
). I'm not sure it's in the current CRAN release (2015-04-07)...
这是我们需要添加的内容:
Here's what we needed to add:
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)
}
这篇关于zelig软件包中的texreging Tobit输出(R)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!