The objectives of this problem set is to orient you to a number of activities in R. And to conduct a thoughtful exercise in appreciating the importance of data visualization. For each question create a code chunk or text response that completes/answers the activity or question requested. Finally, upon completion post your assignment on Rpubs and upload a link to it to the “Problem Set 2” assignmenet on Moodle.
anscombe data that is part of the library(datasets) in R. And assign that data to a new object called data.library(datasets) data<-anscombe data
fBasics() package!)install.packages(“fBasics”) library(“fBasics”)
library(“timeDate”) library(“timeSeries”)
mean(data\(x1) var(data\)x1)
mean(data\(x2) var(data\)x2)
mean(data\(x3) var(data\)x3)
mean(data\(x4) var(data\)x4)
mean(data\(y1) var(data\)y1)
mean(data\(y2) var(data\)y2)
mean(data\(y3) var(data\)y3)
mean(data\(y4) var(data\)y4)
correlationTest(data\(x1,data\)y1)
correlationTest(data\(x2,data\)y2)
correlationTest(data\(x3,data\)y3)
correlationTest(data\(x4,data\)y4)
plot(data\(x1, data\)y1, main=“Scatterplot between x1,y1”)
plot(data\(x2, data\)y2, main=“Scatterplot between x2,y2”)
plot(data\(x3, data\)y3, main=“Scatterplot between x3,y3”)
plot(data\(x4, data\)y4, main=“Scatterplot between x4,y4”) 4. Now change the symbols on the scatter plots to solid circles and plot them together as a 4 panel graphic
par(mfrow=c(2,2)) plot(data\(x1,data\)y1, main=“Scatterplot between x1,y1”,pch=20) plot(data\(x2,data\)y2, main=“Scatterplot between x2,y2”,pch=20) plot(data\(x3,data\)y3, main=“Scatterplot between x3,y3”,pch=20) plot(data\(x4,data\)y4, main=“Scatterplot between x4,y4”,pch=20)
lm() function.fit1<-lm(data\(y1~data\)x1) fit2<-lm(data\(y2~data\)x2) fit3<-lm(data\(y3~data\)x3) fit4<-lm(data\(y4~data\)x4)
par(mfrow=c(2,2)) plot(data\(x1,data\)y1, main=“Scatterplot between x1,y1”,pch=20) abline(fit1, col=“blue”) plot(data\(x2,data\)y2, main=“Scatterplot between x2,y2”,pch=20) abline(fit2, col=“blue”) plot(data\(x3,data\)y3, main=“Scatterplot between x3,y3”,pch=20) abline(fit3, col=“blue”) plot(data\(x4,data\)y4, main=“Scatterplot between x4,y4”,pch=20) abline(fit4, col=“blue”)
anova(fit1)
anova(fit2)
anova(fit3)
anova(fit4)
Anscombe’s Quartet is a proof that even when the statistical values of seems to be alike, they can be totally different when graphed.The dataset’s data vizualization helps in understanding the importance of Data Viz and how it helps in better understanding the data.