tidy_regression: Tidy regression analysis

Description Usage Arguments Details Value Examples

Description

Conducts regression analysis to model outcome variable using OLS, logistic, poisson, and negative-binomial models

Usage

1
tidy_regression(data, model, type = "ols", robust = FALSE, ...)

Arguments

data

Data frame containing variables in model

model

Model formula to be estimated.

type

Type of regression model to use. Available types include "ols", "logistic", "poisson", "negbinom". See regression_types for more information.

robust

Logical indicating whether to estimate a robust model. This is available for all models but negative binomial.

...

Other arguments passed to modeling function.

Details

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

Value

A model object

Examples

 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))

mkearney/tidyacademic documentation built on May 14, 2019, 6:12 a.m.