stargazer

R: why does stargazer return incorrect values for min and max with this dataframe?

可紊 提交于 2020-05-14 02:25:33
问题 I was using stargazer today to make some basic summary tables, and noticed some strange behavior: library(stargazer) my_df <- data.frame(speed = c(3.00,3.20,3.00,3.20,3.10,2.90), age = c(22,24,24,28,19,25)) stargazer(my_df, type="text", summary.stat = c("min", "mean", "max"), digits = 2) Output is: ======================= Statistic Min Mean Max ----------------------- speed 3 3.07 3 age 19 23.67 28 ----------------------- Clearly min should be 2.90 and max should be 3.20, as I've specified

R: why does stargazer return incorrect values for min and max with this dataframe?

隐身守侯 提交于 2020-05-14 02:21:31
问题 I was using stargazer today to make some basic summary tables, and noticed some strange behavior: library(stargazer) my_df <- data.frame(speed = c(3.00,3.20,3.00,3.20,3.10,2.90), age = c(22,24,24,28,19,25)) stargazer(my_df, type="text", summary.stat = c("min", "mean", "max"), digits = 2) Output is: ======================= Statistic Min Mean Max ----------------------- speed 3 3.07 3 age 19 23.67 28 ----------------------- Clearly min should be 2.90 and max should be 3.20, as I've specified

Output several regression tables into multiple pages of a Word document in R

≡放荡痞女 提交于 2020-04-14 07:28:19
问题 My goal is to create a multi-page Microsoft Word document with many formatted regression table outputs on consecutive pages. Ideally this would be done using R Markdown. I have had some luck making nicely formatted regression tables in word using sjPlot::tab_model So for example, I can do mod2 <- lm(Petal.Length ~ Species + Petal.Width, data=iris) sjPlot::tab_model(mod2, file = "~/Desktop/model2.doc") to create a nice-looking regression table in a new Word document. If I do mod3 <- lm(Petal

Appending statistics to coeftest output to include in stargazer tables

纵饮孤独 提交于 2020-03-19 06:03:36
问题 I have a glm model for which I use coeftest from the lmtest package to estimate robust standard errors. When I use stargazer to produce regression tables I get the correct results but without the number of observations and other relevant statistics like the null deviance and the model deviance. Here's an example: library(lmtest) library(stargazer) m1 <- glm(am ~ mpg + cyl + disp, mtcars, family = binomial) # Simple binomial regression # For whatever reason, let's say I want to use coeftest to

How to show significance stars in R Markdown (rmarkdown) html output notes?

血红的双手。 提交于 2020-03-01 14:34:01
问题 I want to show regression outputs in HTML documents using R Markdown. I tried the texreg and stargazer packages. My problem is now, that in the notes I can't bring the significance stars to life. Due to automatic generation it seems I can't escape them. I've been puzzling around with this and this but with no success. What am I missing? Thanks a lot!! Here's some code: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r data} library(car) lm1 <- lm(prestige ~ income +

How to show significance stars in R Markdown (rmarkdown) html output notes?

妖精的绣舞 提交于 2020-03-01 14:32:09
问题 I want to show regression outputs in HTML documents using R Markdown. I tried the texreg and stargazer packages. My problem is now, that in the notes I can't bring the significance stars to life. Due to automatic generation it seems I can't escape them. I've been puzzling around with this and this but with no success. What am I missing? Thanks a lot!! Here's some code: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r data} library(car) lm1 <- lm(prestige ~ income +

How to fix 'Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : missing value where TRUE/FALSE needed' using stargazer in rstudio?

不羁的心 提交于 2020-02-29 21:40:12
问题 I'm trying to print a table of combined lm's in Rstudio using Stargazer and I keep getting this message: Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : missing value where TRUE/FALSE needed This is the code I'm using: stargazer(lm_1, lm_2, lm_3, lm_4, dep.var.labels = c("PolOri_Social_std", "Sexual_Disgust_std"), covariate.labels = c("Gender", "Sexual_Disgust_std"), style = "demography", out = "hierarchical.htm", header = F) Has anyone encountered this before? 回答1: Problem

Extending Stargazer

爱⌒轻易说出口 提交于 2020-02-01 04:21:06
问题 I've long used apsrtable to quickly create model comparison tables, but I find it somewhat unattractive and clunky, so my dissertation tables were hand-coded tables with \Sexpr expressions. I was excited to find stargazer , but disappointed that some models I use aren't supported. With apsrtable you can fairly easily extend a model by updating the apsrtableSummary and ModelInfo methods (as in this question/answer). I've been looking (but haven't found) for a similar method to extend stargazer

First Stage IV Regression Output in R

谁说胖子不能爱 提交于 2020-01-25 06:48:48
问题 I want to report the results of both stages of my Two-Stage Least Square Regression but stargazer output only gives me the second stage. I have calculated a Two-Stage Least Square Regression with the ivreg command in R. This is what my code looks like: ivmodel1 <- ivreg(Y ~ X + W1 + W2 + W3 + W4 | W1 + W2 + W3 + W4 + Z, data = df) where Y = dependent variable (cont.); X = endogenous independent variable (dummy); W1-W4 = control variables; Z = exogenous instrument (dummy) Now I am having

Robust Standard Errors in lm() using stargazer()

戏子无情 提交于 2020-01-25 04:14:26
问题 I have read a lot about the pain of replicate the easy robust option from STATA to R to use robust standard errors. I replicated following approaches: StackExchange and Economic Theory Blog. They work but the problem I face is, if I want to print my results using the stargazer function (this prints the .tex code for Latex files). Here is the illustration to my problem: reg1 <-lm(rev~id + source + listed + country , data=data2_rev) stargazer(reg1) This prints the R output as .tex code (non