broom

Formatted latex regression tables with multiple models from broom output?

冷暖自知 提交于 2021-02-16 07:01:33
问题 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). require(broom) model <- lm(mpg ~ hp + cyl, mtcars) tidy_model <- tidy(model) glance_model <- glance(model) # tidy_model # # A tibble: 3 x 5 # term estimate std.error statistic p.value # <chr> <dbl> <dbl> <dbl> <dbl> # 1 (Intercept) 36.9 2.19 16.8 1.62e-16 # 2 hp -0

Many regressions using tidyverse and broom: Same dependent variable, different independent variables

风格不统一 提交于 2021-02-08 04:50:44
问题 This link shows how to answer my question in the case where we have the same independent variables, but potentially many different dependent variables: Use broom and tidyverse to run regressions on different dependent variables. But my question is, how can I apply the same approach (e.g., tidyverse and broom) to run many regressions where we have the reverse situation: same dependent variables but different independent variable. In line with the code in the previous link, something like: mod

Many regressions using tidyverse and broom: Same dependent variable, different independent variables

佐手、 提交于 2021-02-08 04:49:40
问题 This link shows how to answer my question in the case where we have the same independent variables, but potentially many different dependent variables: Use broom and tidyverse to run regressions on different dependent variables. But my question is, how can I apply the same approach (e.g., tidyverse and broom) to run many regressions where we have the reverse situation: same dependent variables but different independent variable. In line with the code in the previous link, something like: mod

Many regressions using tidyverse and broom: Same dependent variable, different independent variables

ぐ巨炮叔叔 提交于 2021-02-08 04:49:33
问题 This link shows how to answer my question in the case where we have the same independent variables, but potentially many different dependent variables: Use broom and tidyverse to run regressions on different dependent variables. But my question is, how can I apply the same approach (e.g., tidyverse and broom) to run many regressions where we have the reverse situation: same dependent variables but different independent variable. In line with the code in the previous link, something like: mod

how to work with prais.winsten results in stargazer and broom (r)

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-07 09:13:58
问题 The package "prais" contains the function prais.winsten to run a regression models with Prais Winsten estimator. However, neither stargazer nor broom packages seem to work with the results from the prais.winsten function. After fitting a model of the form pw<- prais.winsten(speed ~ dist, cars) When I try to report the results with stargazer I get the following error: stargazer(pw, out = "pw.html") Error: $ operator is invalid for atomic vectors and likewise tidying the model with the broom

How to fit distribution on multiple columns using broom and dplyr

谁都会走 提交于 2021-01-05 08:03:05
问题 I have the following data: library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union set.seed(1) df <- data_frame( genes = paste("Gene_",letters[0:10],sep=""), X = rnorm(10, 0, 1), Y = rnorm(10, 0, 2), Z = rnorm(10, 0, 4)) df #> # A tibble: 10 × 4 #> genes X Y Z #> <chr> <dbl> <dbl> <dbl> #> 1 Gene_a -0.6264538 3.02356234 3

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

旧巷老猫 提交于 2020-11-27 01:53:35
问题 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 anyone know a way to add stars to the output? 回答1: We can use a convenient function stars.pval from gtools to do this library(gtools) library(broom) library(dplyr) data(mtcars) mtcars %>% lm(mpg ~ wt + qsec, .) %>% tidy %>% mutate(signif = stars.pval

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

喜夏-厌秋 提交于 2020-11-27 01:53:28
问题 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 anyone know a way to add stars to the output? 回答1: We can use a convenient function stars.pval from gtools to do this library(gtools) library(broom) library(dplyr) data(mtcars) mtcars %>% lm(mpg ~ wt + qsec, .) %>% tidy %>% mutate(signif = stars.pval

Use broom and tidyverse to run regressions on different dependent variables

筅森魡賤 提交于 2020-05-11 04:43:00
问题 I'm looking for a Tidyverse / broom solution that can solve this puzzle: Let's say I have different DVs and a specific set of IVS and I want to perform a regression that considers every DV and this specific set of IVs. I know I can use something like for i in or apply family, but I really want to run that using tidyverse . The following code works as an example ds <- data.frame(income = rnorm(100, mean=1000,sd=200), happiness = rnorm(100, mean = 6, sd=1), health = rnorm(100, mean=20, sd = 3),

Use broom and tidyverse to run regressions on different dependent variables

吃可爱长大的小学妹 提交于 2020-05-11 04:41:44
问题 I'm looking for a Tidyverse / broom solution that can solve this puzzle: Let's say I have different DVs and a specific set of IVS and I want to perform a regression that considers every DV and this specific set of IVs. I know I can use something like for i in or apply family, but I really want to run that using tidyverse . The following code works as an example ds <- data.frame(income = rnorm(100, mean=1000,sd=200), happiness = rnorm(100, mean = 6, sd=1), health = rnorm(100, mean=20, sd = 3),