Displaying p-values instead of SEs in parenthesis

user3799604 picture user3799604 · Jul 3, 2014 · Viewed 10.2k times · Source

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?

Answer

landroni picture landroni · Feb 16, 2015

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 than the se's
stargazer(linear.1, type="text", report=('vc*p'))

Which will output:

> stargazer(linear.1,  type="text", report=('vc*p'))

========================================
                 Dependent variable:    
             ---------------------------
                       rating           
----------------------------------------
complaints            0.692***          
                     p = 0.0002         

privileges             -0.104           
                      p = 0.450         

learning                0.249           
                      p = 0.132         

raises                 -0.033           
                      p = 0.870         

critical                0.015           
                      p = 0.918         

Constant               11.010           
                      p = 0.357         

----------------------------------------
Observations             30             
R2                      0.715           
Adjusted R2             0.656           
F Statistic           12.060***         
========================================
Note:        *p<0.1; **p<0.05; ***p<0.01

This approach is safer than using the se argument, and doesn't mess the significance stars.

See also: