[R] Seeking help for outomating regression (over columns) and storing selected output

Thomas Lumley tlumley at u.washington.edu
Sat Apr 3 20:34:30 CEST 2004

On Sat, 3 Apr 2004, Gabor Grothendieck wrote:
> 2. Another possibility is to create a giant regression that does
> all the usergroup specific regressions at once and then repeat
> it without the usergroup variable to get the rest.
> df2 is a new data frame that strings out all the x variables into
> a single long column and adds a new factor i that identifies
> which x variable it is.  y and u are repeated three times to bring
> them into line with x.  (


> 3. Note that the giant regression approach works as long as you are only
> interested in the coefficients, however, if you were interested in the
> variances then this would not work since each of the two regressions uses a
> pooled estimate of variance.
> QUESTION:  As a matter of interest, would someone that is familiar with random
> effects models show what the corresponding giant model is with separate
> variances for each regression.

There are actually two answers to this.  The first is that if you use the
White/Huber robust/sandwich/model-agnostic variances you get the right
variances automatically.  This is useful when you what to compare
coefficients across models.

On the other hand, I don't think you can get the answer you are looking
for.  The problem is that the giant regression estimates are not MLEs for
anything, and so I think you can't get lme() to simultaneously get the
right coefficients and the right variances.


More information about the R-help mailing list