It's not OK. Treat the results from rlm as having infinite df since the
theory is asymptotic (use pnorm not pt), and don't expect anything useful
in samples as small as 10 cases (30+, preferably 100+ would be OK).
On Fri, 11 Jun 2004, Nathan Weisz wrote:
> Dear List,
>
> I used rlm to calculate two regression models for two data sets (rlm
> due to two outlying values in one of the data sets). Now I want to
> compare the two regression slopes. I came across some R-code of Spencer
> Graves in reply to a similar problem:
> http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg06666.html
>
> The code was:
>
> > df1 <- data.frame(x=1:10, y=1:10+rnorm(10)) #3observations in
> original code
> > df2 <- data.frame(x=1:10, y=1:10+rnorm(10))
> >
> > fit1 <- lm(y~x, df1)
> > s1 <- summary(fit1)$coefficients
> > fit2 <- lm(y~x, df2)
> > s2 <- summary(fit2)$coefficients
> >
> > db <- (s2[2,1]-s1[2,1])
> > sd <- sqrt(s2[2,2]^2+s1[2,2]^2)
> > df <- (fit1$df.residual+fit2$df.residual)
> > td <- db/sd
> > 2*pt(-abs(td), df)
> [1] 0.9510506
>
> However when I use rlm instead of lm I get NA for df.residual.
> > fit1 <- rlm(y~x, df1)
> > fit1$df.residual
> [1] NA
>
> Does this mean that I can not apply the code for values gained by rlm?
> In the example above I continued by taking the df from:
> > summary(fit1)$df[2]
> [1] 8
>
> Is this o.k.?
>
> Help greatly appreciated.
>
> Best,
> Nathan Weisz
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
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, UK Fax: +44 1865 272595