Description Usage Arguments Details Value Examples
Conducts regression analysis to model outcome variable using OLS, logistic, poisson, and negative-binomial models
1 | tidy_regression(data, model, type = "ols", robust = FALSE, ...)
|
data |
Data frame containing variables in model |
model |
Model formula to be estimated. |
type |
Type of regression model to use. Available types include
|
robust |
Logical indicating whether to estimate a robust model. This is available for all models but negative binomial. |
... |
Other arguments passed to modeling function. |
In addition to being a wrapper function for lm,
glm, and robust models via rlm (for robust OLS)
and glmRob this function (a) ensures data
arguments
appear in first position for better consistency and easier piping and (b)
stores information about the call
A model object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## predict mpg using weight and cylinders
m_ols <- datasets::mtcars %>%
tidy_regression(mpg ~ wt + cyl)
## sweep and view summary
(s_ols <- sweep(m_ols))
## logistic regression predict am using disp, carb, and mpg
m_logistic <- datasets::mtcars %>%
tidy_regression(am ~ disp + carb + mpg, type = "logistic")
## sweep and view summary
(s_logistic <- sweep(m_logistic))
## poisson regression predict cyl using disp, carb, and mpg
m_poisson <- datasets::mtcars %>%
tidy_regression(cyl ~ disp + carb + mpg, type = "poisson")
## sweep and view summary
(s_poisson <- sweep(m_poisson))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.