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)
library("ggplot2")
library(scales)
library(RColorBrewer)
library(reshape2)
setwd("/Volumes/KINGSTON/MedScholars/Data")
educ1 <- read.csv("Data analysis workbook 5_edu.csv")
Correlation between ERC and Years of Education
corr1<-lm(ERC_avg~Education,data = educ1)
summary (corr1)
##
## Call:
## lm(formula = ERC_avg ~ Education, data = educ1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.64236 -0.20996 -0.04316 0.17982 0.58890
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.13784 0.47848 6.558 6.96e-08 ***
## Education -0.04922 0.02868 -1.716 0.0936 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3066 on 41 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.06703, Adjusted R-squared: 0.04428
## F-statistic: 2.946 on 1 and 41 DF, p-value: 0.09365
Correlation between SRLM and Years of Education
corr2<-lm(SRLM_avg~Education,data = educ1)
summary (corr2)
##
## Call:
## lm(formula = SRLM_avg ~ Education, data = educ1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.126260 -0.039644 0.000924 0.034633 0.157153
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.583142 0.094137 6.195 2.29e-07 ***
## Education -0.001318 0.005642 -0.234 0.816
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.06032 on 41 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.00133, Adjusted R-squared: -0.02303
## F-statistic: 0.0546 on 1 and 41 DF, p-value: 0.8164
Correlation between SRLM and Age
corr3<-lm(SRLM_avg~Age,data = educ1)
summary (corr3)
##
## Call:
## lm(formula = SRLM_avg ~ Age, data = educ1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.110721 -0.032315 0.006491 0.031379 0.135860
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.7385856 0.0631518 11.695 1.22e-14 ***
## Age -0.0026313 0.0009287 -2.833 0.00711 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05519 on 41 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1637, Adjusted R-squared: 0.1433
## F-statistic: 8.028 on 1 and 41 DF, p-value: 0.007114
Linear regression predicting SRLM with Age and Education
corr4<-lm(SRLM_avg~Age+Education,data = educ1)
summary (corr4)
##
## Call:
## lm(formula = SRLM_avg ~ Age + Education, data = educ1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.110913 -0.032236 0.006584 0.031328 0.135928
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.7362731 0.1030733 7.143 1.19e-08 ***
## Age -0.0026340 0.0009450 -2.787 0.00809 **
## Education 0.0001503 0.0052536 0.029 0.97732
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05588 on 40 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1638, Adjusted R-squared: 0.1219
## F-statistic: 3.917 on 2 and 40 DF, p-value: 0.02797
Linear regression predicting SRLM with Age x Education
corr5<-lm(SRLM_avg~Age+Education+I(Age*Education),data = educ1)
summary (corr5)
##
## Call:
## lm(formula = SRLM_avg ~ Age + Education + I(Age * Education),
## data = educ1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.107093 -0.028620 0.005766 0.023842 0.140072
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.1269938 0.6146907 -0.207 0.837
## Age 0.0099601 0.0088929 1.120 0.270
## Education 0.0517849 0.0366283 1.414 0.165
## I(Age * Education) -0.0007522 0.0005282 -1.424 0.162
##
## Residual standard error: 0.05517 on 39 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2051, Adjusted R-squared: 0.1439
## F-statistic: 3.354 on 3 and 39 DF, p-value: 0.02846