[R] split and rlm

Stuart Luppescu s-luppescu at uchicago.edu
Mon Oct 11 16:27:32 CEST 2004

Hello, I'm trying to do a little rlm of some data that looks like this:

UNIT    COHORT     perdo     adjodds
 1010      96      0.39890    1.06894
 1010      97      0.48113    1.57500
 1010      98      0.36328    1.21498
 1010      99      0.44391    1.38608

It works fine like this: rlm(perdo ~ COHORT, psi=psisquare)
But the problem is that I have about 100 UNITs, and I want to do a
separate rlm for each one. I tried to use split and lapply but it didn't
work at all. Is this possible?

In addition, I'm trying to extract the t statistic for the slope
coefficient and the degrees of freedom so I can put them into dt() to
get the p-value. I can get the t from coef(summary(u))[2,3] (where u is
my rlm object), but u$df.residual gives me NULL. Also, the help for
summary.lm says it returns coefficients, which contains a 4x4 matrix
including the p-values, but when I do summary(u)$coefficients I get:

                                       Value Std. Error    t value
(Intercept)                      0.151756859 3.00972988 0.05042209
drops$COHORT[drops$UNIT == unit] 0.002769108 0.03086700 0.08971097

Any help with this, and on getting the degrees of freedom or the p-value
would be much appreciated. 

Stuart Luppescu -=- s-luppescu .at. uchicago.edu        
University of Chicago -=- CCSR 
才文と智奈美の父 -=-    Kernel 2.6.8-gentoo-r3                
"I don't remember debates.  I don't think we spent 
 a lot of time debating it. Maybe we did, but I
 don't remember."  George W. Bush July 27, 1999
 Referring to whether he had discussions about the 
 Vietnam War while an undergraduate at Yale

More information about the R-help mailing list