# Re: [R] Ancova: formula with a common intercept

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Tue, 03 Jun 2008 09:10:07 +1200

On 3/06/2008, at 2:56 AM, Daniel Brewer wrote:

> I have some data with two categorises plus/minus (p53) and a
> particular
> time (Time) and the outcome is a continuous vairable (Result). I
> set up
> a maximum model.
> ancova <- lm(Result~Time*p53)
>> summary(ancova)
> ..
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 0.05919 0.55646 0.106 0.916
> Time -0.02134 0.01785 -1.195 0.241
> p53plus 0.17059 0.78696 0.217 0.830
> Time:p53plus 0.11887 0.02524 4.709 4.62e-05 ***
> ..
>
>> From a plot of the data and the result of the linear model it
>> looks like
> the two categories share the same intercept. How do I define this? I
> tried this:
>> ancova2<-update(ancova,~.-1)
>> summary(ancova2)
> Call:
> lm(formula = Result ~ Time + p53 + Time:p53 - 1)
> ..
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> Time -0.02134 0.01785 -1.195 0.241
> p53minus 0.05919 0.55646 0.106 0.916
> p53plus 0.22977 0.55646 0.413 0.682
> Time:p53plus 0.11887 0.02524 4.709 4.62e-05 ***
>
> But I do not think that is doing what I want.

You're right --- that's not what you want. That simply gives you a different
parameterization of the original model. Use either

fit1 <- lm(Result ~ Time + Time:p53)

or

fit2 <- lm(Result ~ Time:p53)

which give 2 different parameterizations of the model you want.

cheers,

Rolf Turner

P. S. I believe that it's strictly speaking incorrect to refer to such model as an
``ancova'' model. My recollection is that the ``classical'' use of the term ancova
refers to models in which the slopes are identical but the intercepts (possibly)
different. So a model in which both slopes and intercepts are allowed to differ
from level to level of a factor is not an ancova model. But it's all just jargon
anyway.

R. T.

```######################################################################
```
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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. Received on Mon 02 Jun 2008 - 22:06:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 22:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.