[R] Ancova: formula with a common intercept

Rolf Turner r.turner at auckland.ac.nz
Mon Jun 2 23:10:07 CEST 2008


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}}



More information about the R-help mailing list