Orthogonality calculations after Burrill

Version 2013-01-12 21:27:15

Test \( \LaTeX \) mode on wiki?

library(coefplot2)
dat <- read.table("pulse.txt", header = TRUE, check.names = FALSE)
library(plyr)
dat <- rename(dat, c(PuBefor = "P1", PuAfter = "P2", Sex = "S", `Smokes?` = "K", 
    `Ran?` = "G"))
dat <- subset(dat, select = c(P1, P2, G, K, S))
summary(dat)
##        P1              P2        G        K           S     
##  Min.   : 48.0   Min.   : 50   no :57   no :64   female:35  
##  1st Qu.: 64.0   1st Qu.: 68   yes:35   yes:28   male  :57  
##  Median : 71.0   Median : 76                                
##  Mean   : 72.9   Mean   : 80                                
##  3rd Qu.: 80.0   3rd Qu.: 85                                
##  Max.   :100.0   Max.   :140
## recode: G: 1=experimental, 2=control
dat <- transform(dat, G = 3 - as.numeric(G), K = 3 - as.numeric(K), S = 3 - 
    as.numeric(S))
summary(m1 <- lm(P2 ~ (P1 + G + S + K)^3, data = dat))
## 
## Call:
## lm(formula = P2 ~ (P1 + G + S + K)^3, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -19.322  -3.359   0.511   2.508  27.461 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept) 131.7039   111.6678    1.18     0.24
## P1           -1.3445     1.5374   -0.87     0.38
## G           -38.5096    51.1171   -0.75     0.45
## S            19.6285    62.9953    0.31     0.76
## K           -79.8555    65.4931   -1.22     0.23
## P1:G          0.8671     0.6807    1.27     0.21
## P1:S          0.3258     0.7536    0.43     0.67
## P1:K          1.2570     0.9498    1.32     0.19
## G:S         -26.2884    38.8808   -0.68     0.50
## G:K          21.9553    24.3581    0.90     0.37
## S:K          22.4863    31.6429    0.71     0.48
## P1:G:S        0.0113     0.3787    0.03     0.98
## P1:G:K       -0.4236     0.3788   -1.12     0.27
## P1:S:K       -0.2912     0.4085   -0.71     0.48
## G:S:K         1.5421     9.7982    0.16     0.88
## 
## Residual standard error: 7.69 on 77 degrees of freedom
## Multiple R-squared: 0.829,   Adjusted R-squared: 0.798 
## F-statistic: 26.6 on 14 and 77 DF,  p-value: <2e-16
convANOVA(anova(m1))
## Analysis of Variance Table
## 
## Response: P2
##            Df Sum Sq Mean Sq F value Pr(>F)    
## Regression 14  22034    1574    26.6 <2e-16 ***
## Error      77   4556      59                   
## Total      91  26590                           
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coefplot2(m1)

plot of chunk coefplot1