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
1
vote
1 answer

Adding predictions to tidy models and plotting

My goal is quite simple, it is to predict (with confidence intervals) future values from many linear models then plot them with ggplot2 as an extension to the real data. I have a datset with four variables: Area (factor), date, series (nominal; A, B…
C. W.
  • 25
  • 6
1
vote
1 answer

Displaying a broom::tidy tibble as a printed summary table

I have what may seem like a strange question (but details of why I'm asking will become clear soon). Consider fitting a linear model in R, as follows: lm_fit <- lm(mpg ~ cyl+disp, data = mtcars). Now suppose we produce a tidy tibble (named out_summ)…
user4687531
  • 1,021
  • 15
  • 30
1
vote
1 answer

Augment a mable: residuals and innovations from regression with ARMA errors model are the same

I think there is something odd here. For example the following code gives the same values for residuals and innovations: fit <- us_change %>% model(ARIMA(Consumption ~ Income)) %>% augment() It seems that the augment() function extracts only…
QuantumJazz
  • 139
  • 9
1
vote
2 answers

dot notation in magrittr pipe not be

I thought I understood that in conjunction with the magrittr pipe, the dot-notation indicates where the dataset that is piped into a function should go for evaluation. When I was starting to work with purrr/broom to generate some nested dataframes…
Mario Niepel
  • 1,095
  • 4
  • 19
1
vote
1 answer

annotate grouped linear models with dplyr, broom, and ggplot

I am starting to delve into broom to visualize simple statistical analysis in dplyr/ggplot. I worked out how to get linear models by grouping to work well using by tying in broom::augment. I have three questions: What is the elegant way to tie in…
Mario Niepel
  • 1,095
  • 4
  • 19
1
vote
1 answer

Generating tidy model statistics using purrr::possibly() within dplyr::group_modify

I am trying to fit many exponential models in testData, however, do to variation in patterns of mass gain among testData$ID, this model will not succeed for many individuals. The goal was to produce a broom::tidy data frame where all the statistics…
SGE
  • 311
  • 3
  • 10
1
vote
1 answer

Fit model with multiple responses using each predictor columns individually store results in dataframe

Reference is made towards Fit model using each predictor columns indiviually store results in dataframe, where a dataframe consists one column of a response variable and several columns of predictor variables. The author wished to fit models for the…
JujutsuR
  • 81
  • 6
1
vote
1 answer

Two sample t-test in multiple groups with multiple variables / metrics using tidyverse and broom package

Using the following data df <- data.frame(category = sample(1:3, replace = TRUE, 50), testgroup = sample(c('A', 'B'), replace = TRUE, 50), var_1 = rnorm(50), var_2 = rnorm(50), var_3 =…
Rami Al-Fahham
  • 617
  • 1
  • 6
  • 10
1
vote
2 answers

Pooling results of multiple imputation, pool() function error, mice package

I am new to multiple imputation. I followed tutorials that I found online and performed multiple imputations on my own data. Everything went well until the very last step when I need to pool results from different data sets with imputed values. R…
Athena
  • 27
  • 5
1
vote
1 answer

Using nest and map in combination with mgcv gam and broom augment

I am trying to create a smooth spline for each sample in a grouped dataframe. For this I am using a nest and map approach and mgcv gam (following this example…
1
vote
1 answer

R: create publishable tables of several regression outputs

I´ve ben analyzing data for a paper and have now obtained results in mutiple linear regression. However the summaries R provides are not really fir for publication in the final paper. Also I have specified one variable in several different ways, to…
1
vote
1 answer

Using regression model to generate predicted values with broom package

I have a dataframe of student attributes and test scores, and I've created a linear model for each grade level (1 through 12). I am using the broom package to efficiently create a model for each grade level. Below is a simplified example dataset and…
ra_learns
  • 51
  • 6
1
vote
2 answers

Broom Package - Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

I have a dataframe of student attributes and test scores, and I am trying to fit a linear model for each grade level (1 through 12). I am using the broom package to efficiently create a model for each grade level. Below is a simplified example…
ra_learns
  • 51
  • 6
1
vote
1 answer

(tidy, glance, augment) with exec

I see from the purrr documentation that it should be possible to map a list of functions onto arguments using the map(list(fn1, fn2, fn3), exec, !!!args) syntax or something similar. How would this work for the broom functions tidy, glance, and…
Curt F.
  • 4,690
  • 2
  • 22
  • 39
1
vote
1 answer

Problem with grouped psych::alpha within the do::dplyr/tidyverse and broom::tidy

I have survey data performed using the same questionnaire in different languages. I would like to write an elegant dplyr/tidyverse code for the reliability for each language, using psych::alpha within. Let's imagine, that the data frame (df) looks…