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. For numeric
dependent variables the models are estimated using `lm`

for models without and `plm`

for models with fixed
effects. Binary dependent variable models are estimated using
`glm`

(with `family = binomial(link="logit")`

).
You can override this behavior by specifying the model with the
`models`

parameter. Multinomial logit models are not supported.
Clustered standard errors are estimated using `plm`

's robust
covariance matrix estimators for OLS and
`cluster.vcov`

for logit models.
Only up to two dimensions are supported for fixed effects and standard
error clusters need to be also present as fixed effects.
If run with `byvar`

, only levels that have more observations than
coefficients are estimated.

A list containing two items

- "models"
A list containing the model results and by values if appropriate

- "table"
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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.