[R] what is the intercept of a two-way anova model without interaction term?

2010-04-14 Thread Xiaokuan Wei
Dear list,

I have a question regarding the meaning of intercept term in a two-way anova 
model without interaction term.

for example (let's assume there is no interaction between factor1 and factor2) :

 df
        val        factor1 factor2
1  48.61533       A      t1
2 171.13535       B      t1
3  65.96884       C      t1
4  63.71222       A      t2
5  80.22049       B      t2
6  96.95929       C      t2
7  38.70078       A      t3
8  99.44787       B      t3
9  36.58818       C      t3

the summary of regression :

 summary(m)
Call:
lm(formula = val ~ factor1 + factor2, data = df)
Residuals:
      1       2       3       4       
5       6       7       8       9 
-19.040  36.889 -17.849  11.000 -39.084  28.084   8.040   2.195 -10.235 
Coefficients:
            Estimate Std. Error t value Pr(|t|)  
(Intercept)    67.66      25.42   2.661   0.0563 .
factor1B       66.59      27.85   2.391   0.0751 .
factor1C       16.16      27.85   0.580   0.5928  
factor2t2     -14.94      27.85  -0.537   0.6200  
factor2t3     -36.99      27.85  -1.328   0.2548  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ 
’ 1 
Residual standard error: 34.11 on 4 degrees of freedom
Multiple R-squared: 0.6669,     Adjusted R-squared: 0.3338 
F-statistic: 2.002 on 4 and 4 DF,  p-value: 0.2589 


This is contrast treatment, and my question is what the intercept (here is 
67.66) represent for?

Thank you.


Xiaokuan


  
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] what is the intercept of a two-way anova model without interaction term?

2010-04-14 Thread Dennis Murphy
Hi:

Perhaps this will clarify some things:

 model.matrix(m)
  (Intercept) factor1B factor1C factor2t2 factor2t3
1   100 0 0
2   110 0 0
3   101 0 0
4   100 1 0
5   110 1 0
6   101 1 0
7   100 0 1
8   110 0 1
9   101 0 1

Now tack on the predicted values from the model:

 cbind(model.matrix(m), predict(m))
  (Intercept) factor1B factor1C factor2t2 factor2t3
1   100 0 0  67.65502
2   110 0 0 134.24682
3   101 0 0  83.81768
4   100 1 0  52.71252
5   110 1 0 119.30431
6   101 1 0  68.87518
7   100 0 1  30.66079
8   110 0 1  97.25259
9   101 0 1  46.82345

In the first row, the subject is neither at levels B nor C of factor1, nor
at level t2 of factor2. At what levels of factor1 and factor2 must
this subject be? You'll see a pattern in how the predicted values
are obtained from the level combinations in each observation, the
model and its estimated coefficients. In the process, you'll learn how
treatment contrasts work. Since I smell homework, this is as far
as I'll go.

HTH,
Dennis

On Wed, Apr 14, 2010 at 10:13 AM, Xiaokuan Wei weixiaok...@yahoo.comwrote:

 Dear list,

 I have a question regarding the meaning of intercept term in a two-way
 anova model without interaction term.

 for example (let's assume there is no interaction between factor1 and
 factor2) :

  df
 valfactor1 factor2
 1  48.61533   A  t1
 2 171.13535   B  t1
 3  65.96884   C  t1
 4  63.71222   A  t2
 5  80.22049   B  t2
 6  96.95929   C  t2
 7  38.70078   A  t3
 8  99.44787   B  t3
 9  36.58818   C  t3

 the summary of regression :

  summary(m)
 Call:
 lm(formula = val ~ factor1 + factor2, data = df)
 Residuals:
   1   2   3   4   5   6   7   8   9
 -19.040  36.889 -17.849  11.000 -39.084  28.084   8.040   2.195 -10.235
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)67.66  25.42   2.661   0.0563 .
 factor1B   66.59  27.85   2.391   0.0751 .
 factor1C   16.16  27.85   0.580   0.5928
 factor2t2 -14.94  27.85  -0.537   0.6200
 factor2t3 -36.99  27.85  -1.328   0.2548
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 Residual standard error: 34.11 on 4 degrees of freedom
 Multiple R-squared: 0.6669, Adjusted R-squared: 0.3338
 F-statistic: 2.002 on 4 and 4 DF,  p-value: 0.2589


 This is contrast treatment, and my question is what the intercept (here is
 67.66) represent for?

 Thank you.


 Xiaokuan



[[alternative HTML version deleted]]


 __
 R-help@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.



[[alternative HTML version deleted]]

__
R-help@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.