[R] Linear Models with mean as Intercept.

From: Ghislain Vieilledent <ghislainv_at_gmail.com>
Date: Thu 30 Jun 2005 - 23:35:30 EST


Dear advanced statisticians,

*******Objectif********

I try to set up linear models with mean as intercept: Answer: y
Variable: x, as factor of two modalities: x(1), x(2).

I would like to have a model as:
y = mean(y)+A(i)+residuals,
with i in (1,2) and A(1) coefficient for x(1) and A(2) coefficient for x(2).

*******Trials in R*******

## Firstly:

I write in R:
>Model<-lm(y~x,Data)
>summary(Model)

...
I've got the coefficients for:
- the intercept (x(1) as been choosen) that we can call B(1) - the second modality: x(2) that we can call B(2)

If I have well understood we have for the model and predictions: if x(1): y=B(1)
if x(2): y=B(1)+B(2)
which is quite different as y=mean(y)+A(i)

## Secondly
I tried to skip the intercept
>Model2<-lm(y~0+x,Data)
>summary(Model2)

...
I've got the coefficients for:
- the first modality: x(1) that we can call C(1) - the second modality: x(2) that we can call C(2)

And the model and predictions, if I'm right, are: if x(1): y=C(1)
if x(2): y=C(2)

Thanks for your help.

Ghislain V., retarded statistician.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 30 23:45:27 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:07 EST