这是另一个可以使用的功能。它是为lm定义的xtable的修改版本。 即我刚刚修改了函数xtable.summary.lm for tobit情况。 它也将对齐到其他xtable功能
xtable.summary.tobit <-
function (x, caption = NULL, label = NULL, align = NULL, digits = NULL,
display = NULL, ...)
{
x <- data.frame(unclass(x$coef), check.names = FALSE)
class(x) <- c("xtable", "data.frame")
caption(x) <- caption
label(x) <- label
align(x) <- switch(1 + is.null(align), align, c("r", "r",
"r", "r", "r"))
digits(x) <- switch(1 + is.null(digits), digits, c(0, 4,
4, 2, 4))
display(x) <- switch(1 + is.null(display), display, c("s",
"f", "f", "f", "f"))
return(x)
}
## Now this should give you the desired result
xtable(summary(tob))
希望它有助于获得期望的结果
@ user734124 - 我通常通过'coeftest()''中和lmtest'然后提取列我想(例如'coeftest(glm.object)[,c(1,3)]'),然后传递给'xtable()'。它不是太有限制,因为我通常不希望所有的xtable输出都是这样,并且喜欢将多个回归合并到一个表中的能力。如果我想将N或R^2添加到合并表中,我使用'print.xtable()'中的'add.to.row'选项。 – 2011-05-06 17:52:35
嗨理查德!不幸的是,它不可能使用xtable(coeftest(Tobit.object))。但感谢输入添加行到表! – user734124 2011-05-06 19:20:06
@ user734124 - 你应该能够用'[,1:4]'提取行。 – 2011-05-06 19:26:55