Questions tagged [broom]

broom is an R package for converting statistical analysis objects into "tidy" data frames

Thebroom package provides functions for converting statistical analysis objects into "tidy" tibbles in the R programming language.

The three main verbs of broom are:

  • tidy() summarizes information about model components;
  • glance() reports information about the entire model;
  • augment() adds informations about observations to a dataset.

For more information:

339 questions
6
votes
2 answers

Formatted latex regression tables with multiple models from broom output?

I have several models such as the example below for which I have estimates, standard errors, p-values, r2 etc. as data.frames in tidy format, but I don't have the original model objects (analysis was run on a different machine).…
benedikt
  • 177
  • 1
  • 10
5
votes
1 answer

Selecting coefficents to plot as dot-and-whiskers

I would like to plot the results of a GAM as dot-and-whisker plots using the dwplot() command in the dotwhisker R package. The example in the package documentation is as follows: #Package preload library(dotwhisker) library(broom) library(dplyr) #…
5
votes
1 answer

Fast Wald confidence intervals for a glm with broom in R

I would like to calculate Wald confidence intervals of the coefficients of a glm on a somewhat large data set, and use broom for a tidy output. mydata <- data.frame(y = rbinom(1e5,1,0.8), x1 = rnorm(1e5), x2 =…
bebru
  • 151
  • 9
5
votes
2 answers

Dot-and-whisker plots of filtered estimates for multiple regression models

I am trying to plot a dot-whisker plot of the confidence intervals for 4 different regression models. The data is available here. #first importing data Q1<-read.table("~/Q1.txt", header=T) # Optionally, read in data directly from figshare. # Q1 <-…
Blundering Ecologist
  • 1,199
  • 2
  • 14
  • 38
5
votes
2 answers

How to perform statistical test using dplyr grouping and then make tibble with broom

I have the following data frame: library(tidyverse) dat <- structure(list(charge.Group3 = c(0.167, 0.167, 0.1, 0.067, 0.033, 0.033, 0.067, 0.133, 0.2, 0.067, 0.133, 0.114, 0.167, 0.033, 0.1, 0.033, 0.133, 0.267, 0.133, 0.233, 0.1, 0.167, 0.067,…
littleworth
  • 4,781
  • 6
  • 42
  • 76
5
votes
2 answers

How to convert fitdistrplus::fitdist summary into tidy format?

I have the following code: x <- c( 0.367141764080875, 0.250037975705769, 0.167204185003365, 0.299794433447383, 0.366885973041269, 0.300453205296379, 0.333686861081341, 0.33301168850398, 0.400142004893329, 0.399433677388411, 0.366077304765104,…
littleworth
  • 4,781
  • 6
  • 42
  • 76
5
votes
3 answers

How can I add stars to broom package's tidy() function output?

I have been using the broom package's tidy() function in R to print my model summaries. However, the tidy() function returns p-values without stars, which makes it a bit weird for many people who are used to seeing stars in model summaries. Does…
bcdeniz
  • 69
  • 1
  • 5
5
votes
3 answers

working with lists of models using the pipe syntax

I often like to fit and examine multiple models that relate two variables in an R dataframe. I can do that using syntax like this: require(tidyverse) require(broom) models <- list(hp ~ exp(cyl), hp ~ cyl) map_df(models, ~tidy(lm(data=mtcars,…
Curt F.
  • 4,690
  • 2
  • 22
  • 39
5
votes
2 answers

Purrr and several multiple regressions in R

I know there are several ways to compare regression models. One way it to create models (from linear to multiple) and compare R2, Adjusted R2, etc: Mod1: y=b0+b1 Mod2: y=b0+b1+b2 Mod3: y=b0+b1+b2+b3 (etc) I´m aware that some packages could perform…
Luis
  • 1,388
  • 10
  • 30
5
votes
1 answer

Handling vectors of different lengths in purrr

I currently have the following Rcode that runs multiple regression models with different predictors, across different subsets, and returns tidied output using the broom package. library(dplyr) library(purrr) library(broom) cars <-…
user3102806
  • 141
  • 6
5
votes
2 answers

keep region names when tidying a map using broom package

I am using the getData function from the raster package to retrieve the map of Argentina. I would like to plot the resulting map using ggplot2, so I am converting to a dataframe using the tidy function from the broom package. This works fine, but…
jkgrain
  • 769
  • 5
  • 20
5
votes
1 answer

How can I apply grouped data to grouped models using broom and dplyr?

I'd like to do the equivalent of fitting a model of gpm (gallons per mile = 1/mpg) to wt in the mtcars data set. That seems easy: data(mtcars) library(dplyr) library(tidyr) library(broom) library(ggplot2) library(scales) mtcars2 <- mtcars %>% …
BillH
  • 125
  • 6
5
votes
1 answer

Chi-square statistic across multiple columns of a dataframe using dplyr or reshape2

I have a question about using dplyr and reshape2 to calculate chi-square statistics across multiple columns. Below is a small dataframe... Sat <- c("Satisfied","Satisfied","Dissatisfied","Dissatisfied", …
Mike
  • 2,017
  • 6
  • 26
  • 53
4
votes
2 answers

How to extract confidence intervals from multiple regression models?

I am extracting the regression results for two different groups as shown in this example below. In the temp data.frame i get the estimate, std.error, statistic and p-value. However, i don't get the confidence intervals. Is there a simple way to…
Jack
  • 813
  • 4
  • 17
4
votes
1 answer

How to include confidence intervals from multiple models in tidy output using broom?

I am trying to output some results, including confidence intervals, from many linear models in a tidy tibble, using broom::tidy, but the output only seems to include the confidence interval from the first model. The linear models have the same…
ricke
  • 155
  • 4
1
2
3
22 23