This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

library(car)
setwd("/Volumes/KINGSTON/MedScholars/Data")
d1 <- read.csv("Data analysis workbook4.csv")

Regression with ERC alone:

lm0 <-lm (DEL~ERC_avg,data = d1)
summary (lm0)
## 
## Call:
## lm(formula = DEL ~ ERC_avg, data = d1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6709 -0.2376  0.0365  0.2509  0.6273 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.6389     0.2305  -2.771  0.00675 ** 
## ERC_avg       0.5097     0.1024   4.978 2.99e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3008 on 92 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.2122, Adjusted R-squared:  0.2036 
## F-statistic: 24.78 on 1 and 92 DF,  p-value: 2.989e-06

Regression with ERC, SRLM, and tau:

lm1 <-lm (DEL~tau+SRLM_avg+ERC_avg,data = d1)
summary(lm1)
## 
## Call:
## lm(formula = DEL ~ tau + SRLM_avg + ERC_avg, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.43768 -0.12118 -0.02816  0.14740  0.44290 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.7515987  0.3453342  -2.176 0.034581 *  
## tau         -0.0004136  0.0001188  -3.483 0.001084 ** 
## SRLM_avg     2.1400044  0.5422291   3.947 0.000263 ***
## ERC_avg      0.1045405  0.1321209   0.791 0.432774    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2154 on 47 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.5925, Adjusted R-squared:  0.5665 
## F-statistic: 22.78 on 3 and 47 DF,  p-value: 2.989e-09

Regression with SRLM and tau:

lm2 <-lm(DEL~SRLM_avg+tau,data = d1)
summary(lm2)
## 
## Call:
## lm(formula = DEL ~ SRLM_avg + tau, data = d1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4184 -0.1262 -0.0076  0.1442  0.4536 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.6110289  0.2949763  -2.071 0.043715 *  
## SRLM_avg     2.3070453  0.4974953   4.637 2.74e-05 ***
## tau         -0.0004233  0.0001177  -3.598 0.000757 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2145 on 48 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.5871, Adjusted R-squared:  0.5699 
## F-statistic: 34.12 on 2 and 48 DF,  p-value: 6.045e-10

Regression with SRLM alone:

lm3 <-lm(DEL~SRLM_avg,data = d1)
summary(lm3)
## 
## Call:
## lm(formula = DEL ~ SRLM_avg, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.70228 -0.19839 -0.05688  0.19193  0.71350 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.9749     0.2035  -4.791 6.10e-06 ***
## SRLM_avg      2.7472     0.3785   7.259 1.06e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2725 on 95 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.3568, Adjusted R-squared:   0.35 
## F-statistic: 52.69 on 1 and 95 DF,  p-value: 1.06e-10

Regression predicting DEL with SRLM and ERC:

lm3a <-lm(DEL~ERC_avg+SRLM_avg,data = d1)
summary(lm3a)
## 
## Call:
## lm(formula = DEL ~ ERC_avg + SRLM_avg, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.60222 -0.17348 -0.04893  0.19674  0.57996 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.36232    0.24088  -5.656 1.78e-07 ***
## ERC_avg      0.30944    0.09659   3.204  0.00187 ** 
## SRLM_avg     2.18849    0.40082   5.460 4.09e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2625 on 91 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.4066, Adjusted R-squared:  0.3935 
## F-statistic: 31.17 on 2 and 91 DF,  p-value: 4.875e-11

Regression comparing SRLM and ERC:

lm3b <-lm(ERC_avg~SRLM_avg,data = d1)
summary(lm3b)
## 
## Call:
## lm(formula = ERC_avg ~ SRLM_avg, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.59274 -0.19930 -0.02754  0.17659  0.79061 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1.3321     0.2159   6.169 1.72e-08 ***
## SRLM_avg      1.6737     0.4012   4.172 6.73e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2872 on 94 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.1562, Adjusted R-squared:  0.1472 
## F-statistic:  17.4 on 1 and 94 DF,  p-value: 6.733e-05

Checking for co-linearity between SRLM and ERC:

vif(lm3a)
##  ERC_avg SRLM_avg 
## 1.168485 1.168485

Checking for co-linearity between tau, SRLM and ERC:

vif(lm1)
##      tau SRLM_avg  ERC_avg 
## 1.348563 1.572470 1.311566

Regression with tau alone:

lm4 <-lm(DEL~tau,data = d1)
summary(lm4)
## 
## Call:
## lm(formula = DEL ~ tau, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.52396 -0.22445  0.07135  0.20551  0.46933 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.7362508  0.0607696   12.12 2.37e-16 ***
## tau         -0.0006964  0.0001213   -5.74 5.87e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2555 on 49 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.4021, Adjusted R-squared:  0.3898 
## F-statistic: 32.95 on 1 and 49 DF,  p-value: 5.873e-07

Regression with tau and ERC:

lm4a <-lm(DEL~tau+ERC_avg, data = d1)
summary(lm4a)
## 
## Call:
## lm(formula = DEL ~ tau + ERC_avg, data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.48677 -0.21911  0.05101  0.20398  0.45787 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.0357077  0.3218560   0.111   0.9121    
## tau         -0.0006096  0.0001232  -4.949 9.58e-06 ***
## ERC_avg      0.3075566  0.1389505   2.213   0.0317 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2459 on 48 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.4574, Adjusted R-squared:  0.4348 
## F-statistic: 20.23 on 2 and 48 DF,  p-value: 4.236e-07

Regression accounting for interaction between tau and SRLM:

lm5 <-lm(DEL~SRLM_avg+tau+I(SRLM_avg*tau),data = d1)
summary(lm5)
## 
## Call:
## lm(formula = DEL ~ SRLM_avg + tau + I(SRLM_avg * tau), data = d1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.36089 -0.13663  0.00956  0.11956  0.52094 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       -1.299432   0.458968  -2.831   0.0068 ** 
## SRLM_avg           3.670779   0.858900   4.274 9.31e-05 ***
## tau                0.001851   0.001189   1.557   0.1262    
## I(SRLM_avg * tau) -0.004659   0.002424  -1.922   0.0607 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2087 on 47 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.6172, Adjusted R-squared:  0.5927 
## F-statistic: 25.25 on 3 and 47 DF,  p-value: 7.023e-10