[R] Format regression result summary
bartjoosen
bartjoosen at hotmail.com
Tue Apr 15 11:24:31 CEST 2008
This should be refined, but it gives you a start:
.dat<- summary(mod)$coefficients
namen <- row.names(.dat)
Est <- .dat[,1]
Err <- .dat[,2]
p <- .dat[,4]
p[p<0.0001] <- "***"
p[p<0.001] <- "**"
p[p<0.01] <- "*"
p[p<0.05] <- "."
p[p>0.05] <-" "
cat(paste(namen,"\t", Est, p, "\n\t\t(",Err,")\n"))
Bart
Thiemo Fetzer wrote:
>
> 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.
>
>
--
View this message in context: http://www.nabble.com/Format-regression-result-summary-tp16636200p16698297.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list