Description Usage Arguments Value Examples
Drawing the coefficient table from model object(s). The wrapper function of texreg
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | table_coef(
m,
format = "screen",
file.name = NULL,
dir = NULL,
m.names = NULL,
order.variable = "original",
vcov.est = NULL,
robust.type = "HC1",
cluster.var = NULL,
boot.sims = 300,
boot.seed = 578,
boot.ncores = 1,
digits = 3,
drop.intercept = FALSE,
drop.intercept.names = "(Intercept)",
drop.variable.names = NULL,
caption = NULL,
custom.variable.names = NULL,
footnote.psymbol = TRUE,
custom.footnote = NULL,
show.table = TRUE,
booktabs = TRUE,
dcolumn = FALSE,
use.packages = FALSE,
stars = c(0.001, 0.01, 0.05, 0.1),
symbol = "dagger",
caption.above = TRUE,
single.row = FALSE,
float.pos = "ht!!",
fontsize = "footnotesize",
encoding_from = NULL,
encoding_to = NULL,
include.deviance = FALSE,
include.smooth = FALSE,
...
)
|
m |
Single or the list of model object. |
format |
The format for the table output (characater). The default is |
file.name |
The name of the file to be saved (character). The default is |
dir |
The directory of the file to be saved. Only applicable when file.name is not |
m.names |
The set of names that identifies each element in |
order.variable |
Order of coefficients in the plot(character/numeric vector).
|
vcov.est |
Single or a list of alternative variance-covariance matrix. Each element must be one of raw variance-covariance matrix, |
robust.type |
The type of robust standard error (applied only when |
cluster.var |
Single or a list of |
boot.sims |
Number of iterations if bootstrap is used. |
boot.seed |
Random number seed if bootstrap is used. |
boot.ncores |
Number of cores to parallelize bootstrap. The default is |
digits |
Rounding decimal points for values in the table. |
drop.intercept |
Drop the intercept from the plot (boulean). If |
drop.intercept.names |
The name(s) of intercept (character/character vector). Needed if |
drop.variable.names |
The name(s) of additional variables to drop (character/character vector) from the ouput. The default is |
caption |
Table title caption (character). The default is to include no title caption. (Not applied if |
custom.variable.names |
List of alternative variable names in the output (character vector). The default is |
footnote.psymbol |
Whether to add p-value symbols in the footnote. |
custom.footnote |
Custom footnote (character). The default is |
show.table |
Return the "screen" table at the end of function (boulean). Always returned if |
booktabs |
See |
dcolumn |
See |
use.packages |
See |
stars |
See |
symbol |
See |
caption.above |
See |
single.row |
See |
float.pos |
See |
fontsize |
See |
encoding_from |
If encoding conversion is required, what is the orignal encoding? (Only used when |
encoding_to |
If encoding conversion is required, what is the encoding to be coverted to? (Only used when |
include.deviance |
See |
include.smooth |
See |
... |
Other options in |
Regression table to be shown in console if format=="screen"
or show.table==TRUE
, NULL
if else.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
## Load Data
library(pscl)
data(vote92)
## Recode Variables
vote92$voteBush <- as.numeric(
factor(vote92$vote,levels=c("Clinton","Bush")))*1 - 1
vote92$bushdis <- sqrt(vote92$bushdis)
vote92$clintondis <- sqrt(vote92$clintondis)
vote92$w <- abs(rnorm(nrow(vote92)))
## Estimate Logistic Regression
fm <- formula(voteBush ~ dem + rep +
clintondis + bushdis +
persfinance + natlecon)
m <- glm(fm, data = na.omit(vote92[,c(all.vars(fm),"w","perotdis")]),
family = binomial("logit"), weights=w)
## Basic Table
table_coef(m)
## Export in Tex
table_coef(m, format = "tex")
## Show in Single Row
table_coef(m, single.row = TRUE)
## Try Different Standard Errors
table_coef(list(m,m,m,m),
m.names = c("Standard","Robust(HC1)","Cluster Robust","Bootstrapped"),
vcov.est = list(NULL,"robust","cluster","boot"),
cluster.var = na.omit(vote92[,c(all.vars(fm),"w","perotdis")])$perotdis)
## Estimate Model by Male and Female Subset
m_male <- glm(fm, data = vote92[vote92$female==0,],
family = binomial("logit"))
m_female <- glm(fm, data = vote92[vote92$female==1,],
family = binomial("logit"))
## Table with Two Models
table_coef(list(m_male,m_female))
## Add Custom Variable Names
vn <- c("(Intercept)",
"Democrat","Republican",
"Ideological Distance from Clinton",
"Ideological Distance from Bush",
"Retrospective Personal Finance",
"Retrospective National Economy")
table_coef(list(m_male, m_female),
m.names = c("Male", "Female"),
custom.variable.names = vn)
## Add Title (Only Tex/HTML)
table_coef(list(m_male, m_female), format="tex",
m.names = c("Male", "Female"),
caption = "Vote for Bush (1992)",
custom.variable.names = vn)
## Omit Some Variables
table_coef(list(m_male, m_female),
m.names = c("Male", "Female"),
drop.variable.names = c("dem","natlecon"),
custom.variable.names = vn[-c(2,7)])
## Reorder Variables So That Intercept Comes at the end
table_coef(list(m_male, m_female),
m.names = c("Male", "Female"),
drop.variable.names = c("dem","natlecon"),
order.variable = c(5, seq(1,4,1)),
custom.variable.names = vn[-c(2,7)])
## Interaction Model
fm2 <- formula(voteBush ~ dem + rep +
clintondis + bushdis +
persfinance + natlecon +
dem*clintondis)
m2 <- glm(fm2, data = vote92,
family = binomial("logit"), weights=w)
table_coef(list(m,m2),
custom.variable.names = c(vn,"Democrat * Distance from Clinton"),
order.variable=c(1,2,4,5,6,7,8,3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.