Unlimited learning, half price | 50% off
Get 50% off unlimited learning

DeclareDesign (version 1.0.8)

tidy_try: Tidy Model Results and Filter to Relevant Coefficients

Description

Tidy function that returns a tidy data.frame of model results and allows filtering to relevant coefficients. The function will attempt to tidy model objects even when they do not have a tidy method available. For best results, first load the broom package via library(broom).

Usage

tidy_try(fit, term = FALSE)

Value

A data.frame with coefficient estimates and associated statistics.

Arguments

fit

A model fit, as returned by a modeling function like lm, glm, or estimatr::lm_robust.

term

A character vector of the terms that represent quantities of interest, i.e., "Z". If FALSE, return the first non-intercept term; if TRUE return all terms.

Examples

Run this code

fit <- lm(mpg ~ hp + disp + cyl, data = mtcars)

tidy_try(fit)

Run the code above in your browser using DataLab