Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying p-values instead of SEs in parenthesis

Tags:

r

stargazer

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?

like image 299
user3799604 Avatar asked Jul 02 '14 23:07

user3799604


1 Answers

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:

  • Unprecise p-values in Stargazer
like image 131
landroni Avatar answered Sep 18 '22 13:09

landroni