s-news
[Top] [All Lists]

Want standard error of a lm slope inside a for loop

To: s-news@lists.biostat.wustl.edu
Subject: Want standard error of a lm slope inside a for loop
From: David Parkhurst <parkhurs@imap.iu.edu>
Date: Sat, 03 Dec 2005 16:53:25 -0500
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
I'm using S-PLUS Enterprise Developer Version 7.0.3 with XP:2005

If I run this code outside of a for loop, it works fine, with the third
line putting the standard error of the slope into se.b1.

  regr<-lm(withrand~when)
  b1<-regr$coefficients[2]
  se.b1<-summary(regr)$coefficients[2,2]

If I put that inside a for loop, I get this error:

Problem in summary(regr)$coefficients[2, 2]: No dim attribute
for array subset of object of class "NULL"
Use traceback() to see the call stack

How can I get the standard error of the slope for a
linear regression inside a for loop?

Thanks for any help.

Dave Parkhurst

<Prev in Thread] Current Thread [Next in Thread>
  • Want standard error of a lm slope inside a for loop, David Parkhurst <=