It’s the homework from class of EIA, analying the relations between x1,x2,x3,x4 and y1, y2.

Summary

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.

The summary of the data shows below:

homework<-read.csv("C:\\Users\\hekai.BEAN_PC\\Desktop\\homework.csv",header=T)
summary(homework)
##        x1               x2              x3               x4        
##  Min.   : 4.450   Min.   :19.76   Min.   : 56.37   Min.   : 3.740  
##  1st Qu.: 7.930   1st Qu.:31.60   1st Qu.:132.46   1st Qu.: 6.840  
##  Median : 9.180   Median :37.85   Median :205.51   Median : 8.690  
##  Mean   : 9.407   Mean   :39.98   Mean   :209.84   Mean   : 9.014  
##  3rd Qu.:11.850   3rd Qu.:45.55   3rd Qu.:246.21   3rd Qu.:10.570  
##  Max.   :13.300   Max.   :86.12   Max.   :524.94   Max.   :23.620  
##        y1               y2        
##  Min.   : 73.67   Min.   :-65.10  
##  1st Qu.:356.58   1st Qu.:-37.30  
##  Median :496.21   Median :-29.50  
##  Mean   :520.59   Mean   :-29.42  
##  3rd Qu.:710.54   3rd Qu.:-19.45  
##  Max.   :986.08   Max.   :  4.10

The correlation coefficients and Pearson’s product-moment correlation

cors<-c(cor(homework$x1,homework$y1),cor(homework$x2,homework$y1),cor(homework$x3,homework$y1),cor(homework$x4,homework$y1),
                         cor(homework$x1,homework$y2),cor(homework$x2,homework$y2),cor(homework$x3,homework$y2),cor(homework$x4,homework$y2))

cors
## [1]  0.9259639 -0.7357892 -0.5850885  0.2375979 -0.6777324  0.7119994
## [7]  0.3761776 -0.1654430
tests<-list(cor.test(homework$x1,homework$y1),cor.test(homework$x2,homework$y1),cor.test(homework$x3,homework$y1),cor.test(homework$x4,homework$y1),
            cor.test(homework$x1,homework$y2),cor.test(homework$x2,homework$y2),cor.test(homework$x3,homework$y2),cor.test(homework$x4,homework$y2))

tests
## [[1]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x1 and homework$y1
## t = 32.624, df = 177, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9017630 0.9443773
## sample estimates:
##       cor 
## 0.9259639 
## 
## 
## [[2]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x2 and homework$y1
## t = -14.455, df = 177, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.7965029 -0.6603856
## sample estimates:
##        cor 
## -0.7357892 
## 
## 
## [[3]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x3 and homework$y1
## t = -9.5985, df = 177, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.6739269 -0.4795712
## sample estimates:
##        cor 
## -0.5850885 
## 
## 
## [[4]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x4 and homework$y1
## t = 3.2542, df = 177, p-value = 0.001362
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.09420871 0.37132971
## sample estimates:
##       cor 
## 0.2375979 
## 
## 
## [[5]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x1 and homework$y2
## t = -12.262, df = 177, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.7498647 -0.5896767
## sample estimates:
##        cor 
## -0.6777324 
## 
## 
## [[6]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x2 and homework$y2
## t = 13.49, df = 177, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.6312488 0.7774791
## sample estimates:
##       cor 
## 0.7119994 
## 
## 
## [[7]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x3 and homework$y2
## t = 5.4015, df = 177, p-value = 2.108e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2429077 0.4955102
## sample estimates:
##       cor 
## 0.3761776 
## 
## 
## [[8]]
## 
##  Pearson's product-moment correlation
## 
## data:  homework$x4 and homework$y2
## t = -2.2318, df = 177, p-value = 0.02688
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3047209 -0.0192375
## sample estimates:
##       cor 
## -0.165443

The fitted plots

library(graphics)
par(mfcol=c(2,4),mar = c(1,1,1,1)+0.1)
Lab.palette <- colorRampPalette(c("blue", "orange", "red"), space = "Lab")
pal<-colorRamp(c("red","blue"))
with(homework,smoothScatter(x1~y1,colramp= Lab.palette))
abline(lm(x1~y1,homework),lwd=2,col="red")
with(homework,smoothScatter(x2~y1,colramp= Lab.palette))
abline(lm(x2~y1,homework),lwd=2,col="red")
with(homework,smoothScatter(x3~y1,colramp= Lab.palette))
abline(lm(x3~y1,homework),lwd=2,col="red")
with(homework,smoothScatter(x4~y1,colramp= Lab.palette))
abline(lm(x4~y1,homework),lwd=2,col="red")
with(homework,smoothScatter(x1~y2,colramp= Lab.palette))
abline(lm(x1~y2,homework),lwd=2,col="red")
with(homework,smoothScatter(x2~y2,colramp= Lab.palette))
abline(lm(x2~y2,homework),lwd=2,col="red")
with(homework,smoothScatter(x3~y2,colramp= Lab.palette))
abline(lm(x3~y2,homework),lwd=2,col="red")
with(homework,smoothScatter(x4~y2,colramp= Lab.palette))
abline(lm(x4~y2,homework),lwd=2,col="red")

Results and findings

{x1,y1} and {x2,y2} are significant positive correlations; {x2,y1},{x3,y1} and {x1,y2} are significant negative correlations