Description Usage Arguments Examples
A flexible way to create a publication-worthy LaTeX table from a list of regressions. Requires the siunitx LaTeX package for compilation.
1 2 3 4 5 |
regs |
A list of model objects (e.g. |
vars |
A
Variable labels can be split over two lines if they are long, as in the example above. |
file |
Filename of the resulting ".tex" file. If omitted it will print the LaTeX source on the screen. |
depvars |
This option can only be omitted if the dependent variable is the
same in each model. If the dependent variables differ, the option must be
specified as a
If the dependent variable is the same in each model, then the variable label can optionally be given as a scalar character argument, for example:
|
vcov |
A list of variance covariance matrices to use for each model.
If omitted it will use the default standard errors given from |
intercept |
Whether or not the intercept should be included in the output |
fixed.effects |
A list specifying which fixed effects were included in the regressions. For example, if there were two regressions with two types of fixed effects, you could have:
The length of the list is the number of fixed effects. The length of each element in the list must by one plus the number of models included. This could also be useful for speficying other types of controls or what subsample of the data you are using. |
number.format |
Number format as in the |
stars |
A vector speficying the significance levels to use for stars. The default uses one star for significance at the 10 at the 5 stars. |
parentheses |
What to include in the parentheses under the coefficients.
Can be one of |
stats |
The statistics to display at the bottom of the output and in
which order you want them. Possible options are |
table.env |
If |
caption |
If wrapping in a table environment, a caption may be provided
here as a character argument. Requires |
caption.position |
If using a caption, use |
stand.alone |
Specifies whether or not the LaTeX preamble should be included in the output. This is useful for testing out the function. |
compile |
If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Create fake data:
N <- 200
test.df <- data.frame(a = rnorm(N), b = runif(N), c = rpois(N, 2),
d = sample(0:1, N, replace = TRUE))
## Run some regresions:
regs <- list()
regs[[1]] <- lm(a ~ b + c, test.df)
regs[[2]] <- lm(a ~ b + d, test.df)
regs[[3]] <- lm(b ~ c + d, test.df)
## Set up the inputs to the function:
vars <- list(b = c("Variable B"),
c = c("Variable C"),
d = c("Long label", "for D"))
depvars <- list("Variable A", "Variable A", c("Long", "label B"))
fe <- list(c("State Fixed Effects", "Yes", "No", "No"),
c("Year Fixed Effects", "No", "No", "Yes"))
## Write LaTeX output:
regTex(regs = regs, vars = vars, depvars = depvars, fixed.effects = fe,
intercept = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.