Description Usage Arguments Details Value Examples
View source: R/prepapre_regression_table.R
Builds a regression table based on a set of user-specified models or a single model and a partitioning variable.
1 2 3 4 5 6 7 8 9 10 |
df |
Data frame containing the data to estimate the models on. |
dvs |
A character vector containing the variable names for the dependent variable(s). |
idvs |
A character vector or a a list of character vectors containing the variable names of the independent variables. |
feffects |
A character vector or a a list of character vectors containing the variable names of the fixed effects. |
clusters |
A character vector or a a list of character vectors containing the variable names of the cluster variables. |
models |
A character vector indicating the model types to be estimated ('ols', 'logit', or 'auto') |
byvar |
A factorial variable to estimate the model on (only possible if only one model is being estimated). |
format |
A character scalar that is passed on |
This is a wrapper function calling the stargazer package. Depending on whether the dependent variable
is numeric, logical or a factor with two levels, the models are estimated
using felm
(for numeric dependent variables)
or glm
(with family = binomial(link="logit")
) (for two-level factors or logical variables).
You can override this behavior by specifying the model with the models
parameter.
Multinomial logit models are not supported.
For glm
, clustered standard errors are estimated using
cluster.vcov
.
For felm
, it is being run with cmethod='reghdfe'
to make clustered standard errors consistent with Stata's 'reghdfe'.
If run with byvar
, only levels that have more observations than coefficients are estimated.
A list containing two items
A list containing the model results and by values if appropriate
The output of stargazer
containing the table
1 2 3 4 5 6 7 8 9 10 11 12 13 | df <- data.frame(year = as.factor(floor(stats::time(datasets::EuStockMarkets))),
datasets::EuStockMarkets)
dvs = c("DAX", "SMI", "CAC", "FTSE")
idvs = list(c("SMI", "CAC", "FTSE"),
c("DAX", "CAC", "FTSE"),
c("SMI", "DAX", "FTSE"),
c("SMI", "CAC", "DAX"))
feffects = list("year", "year", "year", "year")
clusters = list("year", "year", "year", "year")
t <- prepare_regression_table(df, dvs, idvs, feffects, clusters, format = "text")
t$table
t <- prepare_regression_table(df, "DAX", c("SMI", "CAC", "FTSE"), byvar="year", format = "text")
print(t$table)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.