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.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

require(ggplot2)
## Loading required package: ggplot2
library(ggplot2)

week7project2<-read.csv('c:/temp/Week7Project2ForR.csv',header=TRUE)
summary(week7project2)
##        x1             y1               x2             y2       
##  Min.   : 4.0   Min.   : 4.260   Min.   : 4.0   Min.   :3.100  
##  1st Qu.: 6.5   1st Qu.: 6.315   1st Qu.: 6.5   1st Qu.:6.695  
##  Median : 9.0   Median : 7.580   Median : 9.0   Median :8.140  
##  Mean   : 9.0   Mean   : 7.501   Mean   : 9.0   Mean   :7.501  
##  3rd Qu.:11.5   3rd Qu.: 8.570   3rd Qu.:11.5   3rd Qu.:8.950  
##  Max.   :14.0   Max.   :10.840   Max.   :14.0   Max.   :9.260  
##        x3             y3              x4           y4        
##  Min.   : 4.0   Min.   : 5.39   Min.   : 8   Min.   : 5.250  
##  1st Qu.: 6.5   1st Qu.: 6.25   1st Qu.: 8   1st Qu.: 6.170  
##  Median : 9.0   Median : 7.11   Median : 8   Median : 7.040  
##  Mean   : 9.0   Mean   : 7.50   Mean   : 9   Mean   : 7.501  
##  3rd Qu.:11.5   3rd Qu.: 7.98   3rd Qu.: 8   3rd Qu.: 8.190  
##  Max.   :14.0   Max.   :12.74   Max.   :19   Max.   :12.500
str(week7project2)
## 'data.frame':    11 obs. of  8 variables:
##  $ x1: int  10 8 13 9 11 14 6 4 12 7 ...
##  $ y1: num  8.04 6.95 7.58 8.81 8.33 ...
##  $ x2: int  10 8 13 9 11 14 6 4 12 7 ...
##  $ y2: num  9.14 8.14 8.74 8.77 9.26 8.1 6.13 3.1 9.13 7.26 ...
##  $ x3: int  10 8 13 9 11 14 6 4 12 7 ...
##  $ y3: num  7.46 6.77 12.74 7.11 7.81 ...
##  $ x4: int  8 8 8 8 8 8 8 19 8 8 ...
##  $ y4: num  6.58 5.76 7.71 8.84 8.47 7.04 5.25 12.5 5.56 7.91 ...
qplot(week7project2$x1,week7project2$y1,data=week7project2)

qplot(week7project2$x2,week7project2$y2,data=week7project2)

qplot(week7project2$x3,week7project2$y3,data=week7project2)

qplot(week7project2$x1,week7project2$y1,data=week7project2,geom="boxplot")

qplot(week7project2$x2,week7project2$y2,data=week7project2,geom="boxplot")

qplot(week7project2$x3,week7project2$y3,data=week7project2,geom="boxplot")

qplot(week7project2$x1,data=week7project2,geom="histogram")

qplot(week7project2$x2,data=week7project2,geom="histogram")

qplot(week7project2$x3,data=week7project2,geom="histogram")

qplot(week7project2$x1,data=week7project2,geom="bar")

qplot(week7project2$x2,data=week7project2,geom="bar")

qplot(week7project2$x3,data=week7project2,geom="bar")

boxplot(week7project2$x1)

hist(week7project2$x1)

boxplot(week7project2$y1)

hist(week7project2$y1)

boxplot(week7project2$x2)

hist(week7project2$x2)

boxplot(week7project2$y2)

hist(week7project2$y2)

boxplot(week7project2$x3)

hist(week7project2$x3)

boxplot(week7project2$y3)

hist(week7project2$y3)

ggplot(data=week7project2,aes(x=week7project2$x1,y=week7project2$y1))+ geom_line() + geom_point()

ggplot(data=week7project2,aes(x=week7project2$x2,y=week7project2$y2))+ geom_line() + geom_point()

ggplot(data=week7project2,aes(x=week7project2$x3,y=week7project2$y3))+ geom_line() + geom_point()

table(week7project2$x1)
## 
##  4  5  6  7  8  9 10 11 12 13 14 
##  1  1  1  1  1  1  1  1  1  1  1
week7project2<-read.csv('c:/temp/Week7Project2ForR.csv',header=TRUE)
x1<-week7project2$x1
y1<-week7project2$y1
x2<-week7project2$x2
y2<-week7project2$y2
x3<-week7project2$x3
y3<-week7project2$y3
x4<-week7project2$x4
y4<-week7project2$y4

## various derivation for x1 and y1

plot(week7project2$x1,week7project2$y1, main="Scatter Plot of I SET of DATA", xlab="x axis", ylab="y axis",)

abline(lm(x1~y1), col="red") #regression line (y~x)
abline(lm(y1~x1), col="blue") #regression line (y~x)
lines(lowess(x1,y1),col="yellow") #lowess line (x,y)

library(compare)
## Warning: package 'compare' was built under R version 3.1.3
## 
## Attaching package: 'compare'
## 
## The following object is masked from 'package:base':
## 
##     isTRUE
comparison<-compare(x1,y1, allowAll=TRUE)

comparison$tM
##  [1]  4  5  6  7  8  9 10 11 12 13 14
## various derivation for x2 and y2

plot(week7project2$x2,week7project2$y2, main="Scatter Plot of II SET of DATA", xlab="x axis", ylab="y axis",)

abline(lm(x2~y2), col="red") #regression line (y~x)
abline(lm(y2~x2), col="blue") #regression line (y~x)
lines(lowess(x2,y2),col="yellow") #lowess line (x,y)

library(compare)
comparison<-compare(x2,y2, allowAll=TRUE)

comparison$tM
##  [1]  4  5  6  7  8  9 10 11 12 13 14
## various derivation for x3 and y3

plot(week7project2$x3,week7project2$y3, main="Scatter Plot of III SET of DATA", xlab="x axis", ylab="y axis",)

abline(lm(x3~y3), col="red") #regression line (y~x)
abline(lm(y3~x3), col="blue") #regression line (y~x)
lines(lowess(x3,y3),col="yellow") #lowess line (x,y)

library(compare)
comparison<-compare(x3,y3, allowAll=TRUE)

comparison$tM
##  [1]  4  5  6  7  8  9 10 11 12 13 14
## various derivation for x4 and y4

plot(week7project2$x4,week7project2$y4, main="Scatter Plot of IV SET of DATA", xlab="x axis", ylab="y axis",)

abline(lm(x4~y4), col="red") #regression line (y~x)
abline(lm(y4~x4), col="blue") #regression line (y~x)
lines(lowess(x4,y4),col="yellow") #lowess line (x,y)

library(compare)
comparison<-compare(x4,y4, allowAll=TRUE)

comparison$tM
##  [1]  8  8  8  8  8  8  8  8  8  8 19
## All points in one Graph

week7project2<-read.csv('c:/temp/Week7Project2ForR.csv',header=TRUE)
x1<-week7project2$x1
y1<-week7project2$y1
x2<-week7project2$x2
y2<-week7project2$y2
x3<-week7project2$x3
y3<-week7project2$y3
x4<-week7project2$x4
y4<-week7project2$y4

plot(x1,y1, main="Scatter Plot of All SET of DATA", xlab="x axis", ylab="y axis",)
points(x2,y2,col=2,pch=2)
points(x3,y3,col=3,pch=3)
points(x4,y4,col=4,pch=4)

legend(24,80,c("I Set","II Set","III Set","IV Set"),col=c(1,2,3,4),pch=c(1,2,3,4))