stargazer

R stargazer: Different decimals

北战南征 提交于 2019-12-01 08:06:03
问题 I have a problem with my stargazer output in R. Here's my original dataframe: Rank p LMax 10% 5% 1% var1 0.427 24.25 21.8 27.4 31.5 var2 0.228 7.23 11.5 12.2 16.7 What stargazer creates: stargazer(data_summary, summary=FALSE, digits = 3) Rank p LMax 10% 5% 1% var1 0.427 24.250 21.800 27.400 31.500 var2 0.248 7.230 11.500 12.200 16.700 It's important to keep the three digits for p but remain 2 digits for the others. digits = 2 doesn't solve the problem, as p then only has two digits. The

R Stargazer - Manually Specify R^2 And Write to .tex

喜夏-厌秋 提交于 2019-12-01 06:14:17
I am using Stargazer to report the results from some models where I use robust standard errors. The process of calculating these and then feeding the models to Stargazer strips out data such as R^2 and so I need to add it in manually. Doing so, however, is causing me problems. Below is the basic stargazer() call that I'm trying to run. Following it and some discussion is the code needed to generate the data going into the stargazer() call: stargazer(fit1_robust, fit2_robust, keep.stat = c("n", "adj.rsq"), # doesn't actually result in keeping the stats, but including it just to demonstrate such

Stargazer notes line wrap?

北城余情 提交于 2019-12-01 04:56:35
Is there a way to get notes in stargazer to wrap lines instead of running off the page? stargazer(fit.1, notes="A very very long note that I would like to put below the table, but currently runs off the side of the page when I compile my document. How do I get this to wrap into paragraph form?") Which produces: \hline \\[-1.8ex] \textit{Notes:} & \multicolumn{2}{l}{$^{*}$P $<$ .05} \\ & \multicolumn{2}{l}{$^{**}$P $<$ .01} \\ & \multicolumn{2}{l}{$^{***}$P $<$ .001} \\ & \multicolumn{2}{l}{A very very long note that I would like to put below the table, but currently runs off the side of the

Decimal numbers in R stargazer

陌路散爱 提交于 2019-12-01 03:24:44
问题 I am using the R package stargazer to generate tables in Latex. It works great but I cannot figure out how to format my numbers correctly. I want all numbers to show exactly one decimal place (e. g. 1.0, 0.1, 10.5 etc.). I therefore use the option digits = 1. However, for exact numbers like 1 this gives me 1 instead of 1.0. How can I get a decimal place even for exact numbers (1.0 instead of 1)? 回答1: You can use regex to add the decimal places back after using stargazer. Here is an example.

Using stargazer with a list of lm objects created by lapply-ing over a split data.frame

淺唱寂寞╮ 提交于 2019-11-30 21:43:53
I'm trying to create a stargazer table for a set of regressions, where I ran each regression on a subset of my data. The natural way to do this, I would think, is to use split to create a list of data.frames from my data, create a list of lm objects by using lapply on the list of data.frames, and then feed that list to stargazer . For example, library(MASS) library(stargazer) data(Boston) # This doesn't work by.river <- split(Boston, Boston$chas) fit <- lapply(by.river, lm, formula = crim ~ indus) stargazer(fit, type = "text") # % Error: Unrecognized object type. # % Error: Unrecognized object

Resizing a stargazer table in Knitr

心不动则不痛 提交于 2019-11-30 19:54:01
问题 I've put together a document using knitr and while most of the document looks fine, there's one regression table that's too wide to fit on a page without some alteration. The regression table is generated using stargazer, and is quite wide. I've attempted to resize the entire chunk as follows: {r, echo=FALSE, resize.width=10, results='asis'} stargazer( table...) but have had no luck in generating resized output. Is there something that I'm doing wrong, is it not possible to resize these

Obtaining Separate Summary Statistics by Categorical Variable with Stargazer Package

强颜欢笑 提交于 2019-11-30 07:29:14
问题 I would like to use stargazer to produce summary statistics for each category of a grouping variable. I could do it in separate tables, but I'd like it all in one – if that is not unreasonably challenging for this package. For example library(stargazer) stargazer(ToothGrowth, type = "text") #> #> ========================================= #> Statistic N Mean St. Dev. Min Max #> ----------------------------------------- #> len 60 18.813 7.649 4.200 33.900 #> dose 60 1.167 0.629 0.500 2.000 #> -

Odds ratios instead of logits in stargazer() LaTeX output

早过忘川 提交于 2019-11-30 05:01:34
When using stargazer to create a LaTeX table on a logistic regression object the standard behaviour is to output logit-values of each model. Is it possible to get exp(logit) instead? That is, can i get the Odds-ratios instead? In the stargazer documentation the following mentions the "Coef"-argument, but I dont understand if this can enable the exp(logits). Coef: a list of numerical vectors that will replace the default coefficient values for each model. Element names will be used to match coefficients to individual covariates, and should therefore match covariate names. A NULL vector indicates

Multinomial logit in R: mlogit versus nnet

≡放荡痞女 提交于 2019-11-29 08:34:49
问题 I want to run a multinomial logit in R and have used two libraries, nnet and mlogit, which produce different results and report different types of statistics. My questions are: What is the source of discrepency between the coefficients and standard errors reported by nnet and those reported by mlogit ? I would like to report my results to a Latex file using stargazer . When doing so, there is a problematic tradeoff: If I use the results from mlogit then I get the statistics I wish, such as

Obtaining Separate Summary Statistics by Categorical Variable with Stargazer Package

﹥>﹥吖頭↗ 提交于 2019-11-29 04:18:25
I would like to use stargazer to produce summary statistics for each category of a grouping variable. I could do it in separate tables, but I'd like it all in one – if that is not unreasonably challenging for this package. For example library(stargazer) stargazer(ToothGrowth, type = "text") #> #> ========================================= #> Statistic N Mean St. Dev. Min Max #> ----------------------------------------- #> len 60 18.813 7.649 4.200 33.900 #> dose 60 1.167 0.629 0.500 2.000 #> ----------------------------------------- provides summery statistics for the continues variables in