Examples for 'stats::dummy.coef'


Extract Coefficients in Original Coding

Aliases: dummy.coef dummy.coef.lm dummy.coef.aovlist

Keywords: models

### ** Examples

options(contrasts = c("contr.helmert", "contr.poly"))
## From Venables and Ripley (2002) p.165.
npk.aov <- aov(yield ~ block + N*P*K, npk)
dummy.coef(npk.aov)
Full coefficients are 
                                                                               
(Intercept):        54.875                                                     
block:                   1          2          3          4      5      6      
                    -0.850      2.575      5.900     -4.750 -4.350  1.475      
N:                       0          1                                          
                 -2.808333   2.808333                                          
P:                       0          1                                          
                 0.5916667 -0.5916667                                          
K:                       0          1                                          
                  1.991667  -1.991667                                          
N:P:                   0:0        1:0        0:1        1:1                    
                -0.9416667  0.9416667  0.9416667 -0.9416667                    
N:K:                   0:0        1:0        0:1        1:1                    
                    -1.175      1.175      1.175     -1.175                    
P:K:                   0:0        1:0        0:1        1:1                    
                 0.1416667 -0.1416667 -0.1416667  0.1416667                    
N:P:K:               0:0:0      1:0:0      0:1:0      1:1:0  0:0:1  1:0:1 0:1:1
                         0          0          0          0      0      0     0
                     
(Intercept):         
block:               
                     
N:                   
                     
P:                   
                     
K:                   
                     
N:P:                 
                     
N:K:                 
                     
P:K:                 
                     
N:P:K:          1:1:1
                    0
npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)
dummy.coef(npk.aovE)
     Error: (Intercept) 
                      
(Intercept):    54.875

     Error: block 
                                                                               
N:P:K:        0:0:0     1:0:0     0:1:0     1:1:0     0:0:1     1:0:1     0:1:1
          -1.241667  1.241667  1.241667 -1.241667  1.241667 -1.241667 -1.241667
                   
N:P:K:        1:1:1
           1.241667

     Error: Within 
                                                   
N:               0          1                      
         -2.808333   2.808333                      
P:               0          1                      
         0.5916667 -0.5916667                      
K:               0          1                      
          1.991667  -1.991667                      
N:P:           0:0        1:0        0:1        1:1
        -0.9416667  0.9416667  0.9416667 -0.9416667
N:K:           0:0        1:0        0:1        1:1
            -1.175      1.175      1.175     -1.175
P:K:           0:0        1:0        0:1        1:1
         0.1416667 -0.1416667 -0.1416667  0.1416667

[Package stats version 4.2.3 Index]