# [R] Test for equality of coefficients in multivariate multipleregression

Berwin A Turlach berwin at maths.uwa.edu.au
Wed Jul 19 14:43:41 CEST 2006

```G'day John,

>>>>> "JF" == John Fox <jfox at mcmaster.ca> writes:

JF> Simply stacking the problems and treating the resulting
JF> observations as independent will give you the correct
JF> coefficients, but incorrect coefficient variances
Yes, after Andrew's (off-list) answer I realised this too.  If I am
not mistaken, all variances/covariances should be off by a factor of
1/2 or something like that.

JF> and artificially zero covariances.
Well, I must admit that I misread Ulrich's code for most of the day.
I hadn't realised that the variable `tmp' introduces a correlation
between `y1' and `y2' in his code:

> DF<-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
> tmp<-rnorm(100)
> DF\$y1<-tmp+DF\$x1*.5+DF\$x2*.3+rnorm(100,0,.5)
> DF\$y2<-tmp+DF\$x1*.5+DF\$x2*.7+rnorm(100,0,.5)

for some reason, my brain kept parsing this as generate *one* random
intercept for y1 and *one* random intercept for y2, not that each
individual observation has a random intercept.  Under the model that
my brain kept parsing, one would have zero covariances. :)

Now I understand why Andrew suggested the use of mixed models and
would go down that way too.  But I believe your approach is valid too.

JF> (BTW, it's a bit unclear to me how much of this exchange was
JF> on r-help,
Easy, all those that have r-help either in the TO: or CC: field.
Those were Ulrich's original message and the answer by you and Andrew,
I kept all my mails so far off-list.

JF> but I'm copying to r-help since at least one of Ulrich's
JF> messages referring to alternative approaches appeared there.
Yes, I noticed that and answered off-list.  In that message, if I read
it correctly, he had confused Andrew and me.

JF> I hope that's OK.)
Sure, why not? :)

Cheers,

Berwin

```