[R] comparing two regression models with different dependent variable

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jun 10 09:00:26 CEST 2010

We need to define what it means for these models to be the same or
different.  With the usual lm assumptions suppose for i=1, 2 (the two
models) that:

y1 = a1 + X b1 + error1
y2 = a2 + X b2 + error2

which implies the following which also satisfies the usual lm assumptions:

y1-y2 = (a1-a2) + X(b1-b2) + error

Here X is a matrix, a1 and a2 are scalars and all other elements are
vectors.  We say the models are the "same" if b1=b2 (but allow the
intercepts to differ even if the models are the "same").

If y1 and y2 are as in the built in anscombe data frame and x3 and x4
are the x variables, i.e. columns of X, then:

> fm1 <- lm(y1 - y2 ~ x3 + x4, anscombe)
> # this model reduces to the following if b1 = b2
> fm0 <- lm(y1 - y2 ~ 1, anscombe)
> anova(fm0, fm1)
Analysis of Variance Table

Model 1: y1 - y2 ~ 1
Model 2: y1 - y2 ~ x3 + x4
  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1     10 20.637
2      8 18.662  2    1.9751 0.4233 0.6687

so we cannot reject the hypothesis that the models are the "same".

On Wed, Jun 9, 2010 at 11:19 AM, Or Duek <orduek at gmail.com> wrote:
> Hi,
> I would like to compare to regression models - each model has a different
> dependent variable.
> The first model uses a number that represents the learning curve for reward.
> The second model uses a number that represents the learning curve from
> punishment stimuli.
> The first model is significant and the second isn't.
> I want to compare those two models and show that they are significantly
> different.
> How can I do that?
> Thank you.
>        [[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