[R] Avoiding singular fits in rlm

Peter Ehlers ehlers at ucalgary.ca
Thu Dec 3 11:39:40 CET 2009


Matt Crawford wrote:
> I keep coming back to this problem of singular fits in rlm (MASS library),
> but cannot figure out a good solution.
> 
> I am fitting a linear model with a factor variable, like
> lm( Y ~ factorVar)
> and this works fine. lm knows to construct the contrast matrix the way I
> would expect, which puts the first factor as the baseline level.
> 
> But when I try
> rlm( Y ~ factorVar)
> I get the message "'x' is singular: singular fits are not implemented in
> rlm."

Could it be that some level(s) of factorVar have no corresponding
Y-values? Check with table().

  -Peter Ehlers

> 
> How can I solve this problem so that I can use factor variables in rlm?
> 
> I've tried constructing the contrast matrix myself using the various "contr"
> functions, but I always run out of memory. So I must not be doing something
> right, because lm has to create some version of the same contrast matrix in
> memory. In any case, I don't think that more memory is the solution.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.
> 
>




More information about the R-help mailing list