Generating Pretty Statistical Tables
Format statistics from regressions into pretty outputs
bsTab(w, need = c("1T", "1E", "2T", "2E", "3T", "3E", "4T", "4E", "5"), wrap.TE = c("(", "", "["), add.sig = c("coef", "TE"), percent = c(0.01, 0.05, 0.10), symbol = c("***", "**", "*", ""), digits = c(3, 3, 3, 3), ... )
w |
statistical results from regression models; an object of class |
need |
a choice of output formats; default of |
wrap.TE |
parentheses, none, or brackets can be used to enclose t ratios or standard errors; default value is parenthses for one-column format and none for other formats. |
add.sig |
a chacter string to indicate where to add the significance symbol, either to the coefficents ( |
percent |
percentage values used to categorize p values. |
symbol |
symbols used to represent p-value categories; the default values can be changed to symbols like a, b, c, or different combinations of *. |
digits |
digits for outputs; the default values are 3, 3, 3, and 2 for estimate, error, t value, and p value, correspondingly. A single value like 4 can be supplied and it will be recycled for all of them. |
... |
additional arguments to be passed. |
Format statistics from regressions into tables that are often reported in economic journals. The column of 'Variable' in the outuput is the row names of the input data so the raw data should contain meaningful rownames. Besides the variable name column, the maximum number of output is five columns: estimate, error, t ratio, p value, and significance. wrap.TE
and add.sig
are only valid for column widths of 1 and 2.
A dataframe of statistical results.
Changyou Sun (cs258@.msstate.edu)
# a simulated data tes <- data.frame(est = c(4, 56, 12), err = c(0.3, 0.56, 0.789), t.rat = c(2.56, 7.9, 1.2), p.val = c(0.002, 0.23, 0.061)) tes bsTab(tes) bsTab(w = tes, need = "2E") # real data data(daIns) ra <- glm(formula = Y ~ Injury + HuntYrs + Nonres + Lspman + Lnong + Gender + Age + Race + Marital + Edu + Inc + TownPop, family = binomial(link="logit"), data = daIns, x = TRUE) (ca <- data.frame(summary(ra)$coefficients)) # an object of class 'glm' as input bsTab(w = ra, add.sig = "TE") bsTab(w = ra, wrap.TE = "[") bsTab(w = ra, need = "5") bsTab(w = ra, need = "4T", wrap.TE = "[") final <- bsTab(w = ra, need = "3T", percent = c(0.01, 0.05, 0.10), symbol = c("a", "b", "c", ""), digits = 4) final print(final, right = FALSE) # any matrix with at least four columns can be supplied cbind(bsTab(ca), bsTab(ra))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.