stargazer

stargazer left align LaTeX table columns

女生的网名这么多〃 提交于 2019-12-03 10:47:21
stargazer automatically centres values within tables. How can I left align the columns? Put this code in an .Rnw file and use knitr to convert to .tex: <<load, echo=FALSE, warning=FALSE, message=FALSE>>= opts_chunk$set(eval=TRUE, echo=FALSE, warning=FALSE, message=FALSE, dpi=300) @ \documentclass[a4paper,11pt]{article} \usepackage{lipsum} % Required to insert dummy text \begin{document} \title{} \author{} \date{\today} \maketitle \section{Header} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

Get coefficients estimated by maximum likelihood into a stargazer table

冷暖自知 提交于 2019-12-03 06:26:11
问题 Stargazer produces very nice latex tables for lm (and other) objects. Suppose I've fit a model by maximum likelihood. I'd like stargazer to produce a lm-like table for my estimates. How can I do this? Although it's a bit hacky, one way might be to create a "fake" lm object containing my estimates -- I think this would work as long as summary(my.fake.lm.object) works. Is that easily doable? An example: library(stargazer) N <- 200 df <- data.frame(x=runif(N, 0, 50)) df$y <- 10 + 2 * df$x + 4 *

Format model display in texreg or stargazer R as scientific

╄→гoц情女王★ 提交于 2019-12-03 06:23:44
I just ran a statisitical model and i want it to display the results of the model as a table using stargazer. However, the large numbers are displayed in full. fit2<-lm(A~B,data=C) stargazer(fit2,type="text") With this table as result =================================================== Dependent variable: ------------------------------- A --------------------------------------------------- B -0.599 (1.698) 32,126,391.000 (24,004,268.000) --------------------------------------------------- Observations 5 R2 0.040 Adjusted R2 -0.280 Residual Std. Error 31,217,258.000 (df = 3e+00) F Statistic 0

Add a row with notes using stargazer

允我心安 提交于 2019-12-03 02:35:36
I want to run some regressions and create a table with stargazer. For example linear.1 <- lm(rating ~ complaints + privileges + learning + raises + critical, data=attitude) linear.2 <- lm(rating ~ complaints + privileges + learning, data=attitude) stargazer(linear.1, linear.2, type="text", keep.stat=c("n")) I want to add a couple of rows the the table with "X" for some of the specifications. That is: rating (1) (2) ----------------------------------------------------------------- complaints 0.692*** 0.682*** (0.149) (0.129) privileges -0.104 -0.103 (0.135) (0.129) learning 0.249 0.238* (0.160)

Get coefficients estimated by maximum likelihood into a stargazer table

随声附和 提交于 2019-12-02 19:53:05
Stargazer produces very nice latex tables for lm (and other) objects. Suppose I've fit a model by maximum likelihood. I'd like stargazer to produce a lm-like table for my estimates. How can I do this? Although it's a bit hacky, one way might be to create a "fake" lm object containing my estimates -- I think this would work as long as summary(my.fake.lm.object) works. Is that easily doable? An example: library(stargazer) N <- 200 df <- data.frame(x=runif(N, 0, 50)) df$y <- 10 + 2 * df$x + 4 * rt(N, 4) # True params plot(df$x, df$y) model1 <- lm(y ~ x, data=df) stargazer(model1, title="A Model")

Displaying p-values instead of SEs in parenthesis

感情迁移 提交于 2019-12-01 18:00:50
When using the stargazer package, I want to change the value that appears in parentheses under the coefficients. By default, the package will output the standard errors. How can I include the actual p-values in parentheses? landroni As mentioned in Stargazer Omit test statistics , since version 5.0 stargazer has included the report argument that allows users to choose which statistics to report. So to display p-values instead of SEs you would do this: require(stargazer) linear.1 <- lm(rating ~ complaints + privileges + learning + raises + critical, data=attitude) ## put in the p-values rather

Use lapply for multiple regression with formula changing, not the dataset

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 10:53:43
I have seen an example of list apply (lapply) that works nicely to take a list of data objects, and return a list of regression output, which we can pass to Stargazer for nicely formatted output. Using stargazer with a list of lm objects created by lapply-ing over a split data.frame library(MASS) library(stargazer) data(Boston) by.river <- split(Boston, Boston$chas) class(by.river) fit <- lapply(by.river, function(dd)lm(crim ~ indus,data=dd)) stargazer(fit, type = "text") What i would like to do is, instead of passing a list of datasets to do the same regression on each data set (as above),

R stargazer: Different decimals

。_饼干妹妹 提交于 2019-12-01 10:47:00
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 desired output: Rank p LMax 10% 5% 1% var1 0.427 24.25 21.80 27.40 31.50 var2 0.248 7.23 11.50 12.20 16.70

Use lapply for multiple regression with formula changing, not the dataset

天涯浪子 提交于 2019-12-01 09:07:29
问题 I have seen an example of list apply (lapply) that works nicely to take a list of data objects, and return a list of regression output, which we can pass to Stargazer for nicely formatted output. Using stargazer with a list of lm objects created by lapply-ing over a split data.frame library(MASS) library(stargazer) data(Boston) by.river <- split(Boston, Boston$chas) class(by.river) fit <- lapply(by.river, function(dd)lm(crim ~ indus,data=dd)) stargazer(fit, type = "text") What i would like to

Using stargazer with Zelig

China☆狼群 提交于 2019-12-01 08:46:24
I am trying to use stargazer (Version 5.2) to output the standard summary() results of a regression estimated with Zelig (Version 5.0.13). However, I obtain the error Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : ‘result’ is not a valid field or method name for reference class “Zelig-ls” when trying to feed the estimated model into stargazer. A minimal working example reproducing the error would be library(Zelig) library(stargazer) data("swiss") z <- zls$new() z$zelig(Fertility~Education, data=swiss) stargazer(z) I assume I need to somehow access the place where the