Re: [R] Extracting t-tests on coefficients in lm

2007-06-21 Thread Prof Brian Ripley
On Wed, 20 Jun 2007, David C. Howell wrote:

 I am writing a resampling program for multiple regression using lm(). I
 resample the data 10,000 times, each time extracting the regression
 coefficients. At present I extract the individual regression
 coefficients using

  brg = lm(Newdv~Teach + Exam + Knowledge + Grade + Enroll)
  bcoef[i,] = brg$coef

 This works fine.

 But now I want to extract the t tests on these coefficients. I cannot
 find how these coefficients are stored, if at all. When I try
attributes(brg)
 I do not find the t values as the attributes of the object. Typing
 summary(brg) will PRINT the coefficients, their standard errors, t, and
 the associated probability. I would like to type something like
tcoeff[i,] = brg$tvalue
 but, of course, tvalue doesn't exist.

 Is there a simple way to extract, or compute if necessary, these values?

coef(summary(brg)) gives you the table, so coef(summary(brg))[,3] gives 
you the t values (but they are not t-tests per se).

?summary.lm would have told you this.

 Thanks,
 Dave Howell

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting t-tests on coefficients in lm

2007-06-20 Thread David C. Howell
I am writing a resampling program for multiple regression using lm(). I 
resample the data 10,000 times, each time extracting the regression 
coefficients. At present I extract the individual regression 
coefficients using

  brg = lm(Newdv~Teach + Exam + Knowledge + Grade + Enroll)
  bcoef[i,] = brg$coef

This works fine.

But now I want to extract the t tests on these coefficients. I cannot 
find how these coefficients are stored, if at all. When I try
attributes(brg)
I do not find the t values as the attributes of the object. Typing 
summary(brg) will PRINT the coefficients, their standard errors, t, and 
the associated probability. I would like to type something like
tcoeff[i,] = brg$tvalue
but, of course, tvalue doesn't exist.

Is there a simple way to extract, or compute if necessary, these values?

Thanks,
Dave Howell



-- 
David C. Howell
PO Box 770059
627 Meadowbrook Circle
Steamboat Springs, CO
80477

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Extracting t-tests on coefficients in lm

2007-06-20 Thread Chuck Cleland
David C. Howell wrote:
 I am writing a resampling program for multiple regression using lm(). I 
 resample the data 10,000 times, each time extracting the regression 
 coefficients. At present I extract the individual regression 
 coefficients using
 
   brg = lm(Newdv~Teach + Exam + Knowledge + Grade + Enroll)
   bcoef[i,] = brg$coef
 
 This works fine.
 
 But now I want to extract the t tests on these coefficients. I cannot 
 find how these coefficients are stored, if at all. When I try
 attributes(brg)
 I do not find the t values as the attributes of the object. Typing 
 summary(brg) will PRINT the coefficients, their standard errors, t, and 
 the associated probability. I would like to type something like
 tcoeff[i,] = brg$tvalue
 but, of course, tvalue doesn't exist.
 
 Is there a simple way to extract, or compute if necessary, these values?

summary(brg)$coefficients[,3]

str(summary(brg)) is sometimes helpful for figuring out how to extract
something.

  Also, you might have a look at John Fox's document on bootstraping
regression models if you don't already know about it:

http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-bootstrapping.pdf

 Thanks,
 Dave Howell 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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
and provide commented, minimal, self-contained, reproducible code.