regtab | R Documentation |
Computes linear or binomial regressions in two steps : univariate regressions and a multivariate regressions. All the results are nicely displayed side by side with average marginal effects.
regtab(x, y, weights = NULL, continuous = "slopes",
show.ci = TRUE, conf.level = 0.95)
x |
data frame. The explanatory (i.e. independent) variables used in regressions. They can be numerical or factors. |
y |
vector. The outcome (i.e. dependent) variable. It can be numerical (linear regression) or a factor with 2 levels (binomial regression). |
weights |
numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used. |
continuous |
character. The kind of average marginal effects computed for continuous explanatory variables. If "slopes" (defaults), these are average marginal slopes. If "predictions", these are average marginal predictions for a set of values. |
show.ci |
logical. Whether to display the confidence intervals |
conf.level |
numerical value. Defaults to 0.95, which corresponds to a 95 percent confidence interval. Must be strictly greater than 0 and less than 1. |
This function is basically a wrapper for regression functions in the gtsummary
function. It computes a series of univariate regressions (one for each explanatory variable), then a multivariate regression (with all explanatory variables) and displays the results side by side. These results are presented in the form of average marginal effects : average marginal predictions for categorical variables and average marginal slopes (or predictions) for continuous variables.
Besides, the function is compatible with the attribute labels assigned with labelled
package : these labels are displayed automatically.
an object of class tbl_merge
from gtsummary
package
Nicolas Robette
Arel-Bundock V, Greifer N, Heiss A (Forthcoming). “How to Interpret Statistical Models Using marginaleffects in R and Python.” Journal of Statistical Software.
Larmarange J., 2024, “Prédictions marginales, contrastes marginaux & effets marginaux”, in Guide-R, Guide pour l’analyse de données d’enquêtes avec R, https://larmarange.github.io/guide-R/analyses/estimations-marginales.html
cattab
, catdesc
, condesc
, assoc.yx
, darma
, assoc.twocat
, assoc.twocat.by
## Not run:
data(Movies)
regtab(x = Movies[, c("Genre", "Budget", "Festival", "Critics")],
y = Movies$BoxOffice)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.