s-news
[Top] [All Lists]

Re: Extract residual standard error form aov

To: asanquer@virbac.fr
Subject: Re: Extract residual standard error form aov
From: david.thompson@mnr.gov.on.ca
Date: Thu, 29 Jan 2004 11:12:53 -0500
Cc: s-news@wubios.wustl.edu
Annaële,

I was unable to remember how to get this directly but, my toy example below
demonstrates one alternative.

DaveT.

#########################################
### the data:
> SDF1
  blk rep res 
1   1   1  45
2   1   2  98
3   2   1  35
4   2   2  57
5   3   1  84
6   3   2  61

### the model:
> junk <- aov(res~., data=SDF1)

### the output:
> junk
Call:
   aov(formula = res ~ ., data = SDF1)

Terms:
                 blk  rep Residuals 
 Sum of Squares  902  451      1460
Deg. of Freedom    2    1         2

Residual standard error: 27 
Estimated effects are balanced

### the available model components:
> attributes(junk)
$names:
 [1] "coefficients"  "residuals"     "fitted.values" "effects"       "R"
"rank"  
 [7] "assign"        "df.residual"     "contrasts"     "terms"
"call"         

$class:
[1] "aov" "lm" 

$xlevels:
$blk:
[1] "1" "2" "3"

$rep:
[1] "1" "2"

### the desired residual standard error:
> sqrt(sum(resid(junk)^2)/junk$df)
[1] 27

#########################################
DJT: -----Original Message-----
DJT: From: asanquer@virbac.fr [mailto:asanquer@virbac.fr] 
DJT: Sent: January 28, 2004 11:44 AM
DJT: To: s-news@wubios.wustl.edu
DJT: Subject: Extract residual standard error form aov
DJT: 
DJT: 
DJT: Hi,
DJT: 
DJT: My question is certainly very simple, but I cannot find 
DJT: the solution.
DJT: 
DJT: I would like to extract the residual standard error from 
DJT: the result of a
DJT: simple analysis of variance performed with the function 
DJT: aov. In the example
DJT: below, I would like to extract the value 0.5610507.
DJT: 
DJT: > aov(y ~x, data=SDF)
DJT: Call:
DJT:    aov(formula = y ~ x, data = SDF)
DJT: 
DJT: Terms:
DJT:                         Diametre    Residuals
DJT:  Sum of Squares   229.2976    10.7024
DJT: Deg. of Freedom         1                 34
DJT: 
DJT: Residual standard error: 0.5610507
DJT: Estimated effects may be unbalanced
DJT: 
DJT: Thanks,
DJT: 
DJT: Annaële Sanquer

<Prev in Thread] Current Thread [Next in Thread>