[R] Format regression result summary

Tom Chr Backer Johnsen Backer at psysp.uib.no
Mon Apr 14 13:33:51 CEST 2008


Thiemo Fetzer wrote:

As a general rule and practical in many contexts uses the following 
steps: (a) Use the R2HTML library to write the results from the summary 
to the clipboard (b) Open a spreadsheet and paste the results there. 
(c) Edit and shove things around until everything are where you want it 
to be (c) copy and paste things into your document.

Tom

> Hello to the whole group.
> 
> I am a newbie to R, but I got my way through and think it is a lot easier to
> handle than other software packages (far less clicks necessary).
> 
> However, I have a problem with respect to the summary of regression results.
> 
> The summary function gives sth like:
> 
> Residuals:
>      Min       1Q   Median       3Q      Max 
> -0.46743 -0.09772  0.01810  0.11175  0.42252 
> 
> Coefficients:
>                              Estimate Std. Error t value Pr(>|t|)    
> (Intercept)                  3.750367   0.172345  21.761  < 2e-16 ***
> Var1	                      -0.002334   0.009342  -0.250 0.802948    
> Var2				     0.012551   0.005927   2.117 0.035444 *
> 
> Var3	 		           0.015380   0.074537   0.206 0.836730    
> Var3	                       0.098602   0.026448   3.728 0.000250 ***
> ...
> 
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
> 
> Residual standard error: 0.1614 on 202 degrees of freedom
> Multiple R-squared: 0.1983,     Adjusted R-squared: 0.1506 
> F-statistic: 4.163 on 12 and 202 DF,  p-value: 7.759e-06
> 
> However, my wish is the output to have a format like:
> 
>                              Estimate 
> (Intercept)                  3.750367*** 
> 					(0.172345)
> Var1	                      -0.002334
> 					(0.009342)    
> Var2				     0.012551*
> 					(0.005927)
> 
> Etc. so that the standard errors are in parantheses below the estimates.
> Next to the estimates should be the * indicating significance.
> 
> I thought that should go by accessing the elements in the summary object,
> yet, I got started and figured that is quite complicated. 
> 
> Is there a quick and dirty way? 
> Basically I want the same print-out as the summary, except that I don't want
> the t-statistic and not the p-value, only the significance codes.
> 
> Thanks a lot in advance
> 
> Thiemo
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list