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

From: Prof Brian Ripley <>
Date: Thu, 21 Jun 2007 08:35:47 +0100 (BST)

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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 21 Jun 2007 - 14:06:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jun 2007 - 14:32:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.