Re: [R] extracting F, df and r squared using sapply?

2005-02-19 Thread Dieter Menne
 
 If you look at tmp, all the F statistics, r-squared values, etc. are there, 
 but is there an easy way to get at them reported in a tabulated form?
 

Try:

tb=by(warpbreaks, tension,
  function(x) {
sumlm=summary(lm(breaks ~ wool, data=x))
c(sumlm$df,F=sumlm$fstatistic)
  }
  )
do.call(rbind,tb)

and don't forget to give the df columns a name.

 and no smart-alec comments about bonferonni corrections :)

Use package (or library ???... just kidding) multcomp.

No smart-alec comments about packages and libraries, please.


Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] extracting F, df and r squared using sapply?

2005-02-18 Thread Michael Rennie
Hi, All
How does one remove relevant information from a regression output besides 
just the coefficients?

I've been able to modify the example given under help(by) to give me some 
additional information, but not everything I need.

If you adjust the call statement from what is listed by adding the summary 
statement like so:

tmp - by(warpbreaks, tension, function(x) summary(lm(breaks ~ wool, data=x)))
 sapply(tmp, coef)
I am able to get the coefficients and the p-value (as well as 5 other rows 
of information I don't need, corresponding to St. error of the 
coefficients, t-values and the p-value of the intercept, but I can delete 
all this later).

If you look at tmp, all the F statistics, r-squared values, etc. are there, 
but is there an easy way to get at them reported in a tabulated form?

Specifically, is there a simple way I can adjust the sapply command to 
extract the F statistic, r squared, and degrees of freedom (in addition to 
the coefficients) and have them appear as rows in the output? Ultimately, I 
have 200+ groups that I am running regressions on in the same dataset, so I 
need some way to extract the relevant information in a tabulated form.

and no smart-alec comments about bonferonni corrections :)
Thanks,
Mike
Michael Rennie
Ph.D. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga, ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html