Mean as intercept; model matrices [🇷 for BE/BA]
Dear ElMaestro,
We have tested R codes of your examples with SAS. And SAS comes out the correct answer with intercept equal to the mean. So we have been thinking what it is going wrong with R. Finally, we find that if we change the codes of dummy variables as follows:
Then R and SAS have the same results. Apparently, R has somewhat different from SAS in dealing with
We have tested R codes of your examples with SAS. And SAS comes out the correct answer with intercept equal to the mean. So we have been thinking what it is going wrong with R. Finally, we find that if we change the codes of dummy variables as follows:
❝ Per = as.factor(c(1,1,1,1,1,1,1,2,2,2,2,2,2,2))
to
Per = as.factor(c(1,1,1,1,1,1,1,0,0,0,0,0,0,0))
❝ Seq = as.factor(c(1,1,1,1,2,2,2,1,1,1,1,2,2,2))
to
Seq = as.factor(c(1,1,1,1,0,0,0,1,1,1,1,0,0,0))
❝ Trt = as.factor(c(1,1,1,1,2,2,2,2,2,2,2,1,1,1))
to
Trt = as.factor(c(1,1,1,1,0,0,0,0,0,0,0,1,1,1))
Then R and SAS have the same results. Apparently, R has somewhat different from SAS in dealing with
lm()
, or even with many others... There must be a term in statistics to describe this difference. We just don't know the term yet. However, it becomes more and more interesting now...—
All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
Complete thread:
- Mean as intercept; model matrices ElMaestro 2009-05-20 20:35
- Mean as intercept; model matrices yjlee168 2009-05-21 13:35
- Mean as intercept; model matrices ElMaestro 2009-05-21 14:30
- Mean as intercept; model matrices ElMaestro 2009-05-22 14:39
- Mean as intercept; model matrices yjlee168 2009-05-23 20:06
- Mean as intercept; model matrices Aceto81 2009-05-26 10:28
- Mean as intercept; model matricesyjlee168 2009-05-23 19:30
- Mean as intercept; model matrices ElMaestro 2009-05-23 19:53
- Reparameterization d_labes 2009-05-25 11:47
- Reparameterization yjlee168 2009-05-25 14:17
- Reparameterization ElMaestro 2009-05-25 20:29
- Reparameterized brain d_labes 2009-05-26 08:01
- Mean as intercept; model matrices yjlee168 2009-05-21 13:35