Also we may want to plot points on a graph where the points are of different classes or groups. Below I create a data set with four variable that all have a linear relationship to each other.
group<-data.frame()
indep<-runif(900,0,10)
dep1<-5*indep[1:300]+rnorm(300,3,3)
dep2<-7*indep[301:600]+rnorm(300,2,6)
dep3<-9*indep[601:900]+rnorm(300,1,7)
deps<-c(dep1,dep2,dep3)
group[1:300,1]<-1
group[301:600,1]<-2
group[601:900,1]<-3
groups<-cbind(indep,deps,group)
When we plot without speerating the groups it looks like there might be a linear relationship. However, if you look closely you will see that the plot is slightly cone shaped which should tell you there is something else going on.
plot(deps~indep,groups)
Now lets plot the same data except each group is plotted as a different color
plot(deps~indep,groups,col=c("red","yellow","blue")[V1])
This make it easy to see we have three different groups that all have a linear relationship. we can even plot them adding the regression line for each one.
plot(deps~indep,groups,col=c("red","yellow","blue")[V1])
abline(lm(deps[1:300]~indep[1:300],groups),lwd=2)
abline(lm(deps[301:600]~indep[301:600],groups),lwd=3)
abline(lm(deps[601:900]~indep[601:900],groups),lwd=4)
Next time I will do pairs plots in base r which is really useful to look at the relationship of each variable to another.
This comment has been removed by the author.
ReplyDelete
ReplyDeleteGreat Article
R Project Topics for Computer Science
FInal Year Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in
Chennai
Update Valid exam dummps MuleSoft MCD-Level-1 Dumps Questions Answers
ReplyDeleteReally liked your work and has been following it for a long time now.
ReplyDelete온라인경마
경마사이트
This is wonderful website to find blogs on various topics. 바카라사이트
ReplyDeleteDownload the Google Professional-Cloud-Network-Engineer Q&A PDF file easily to prepare Professional Cloud Network Engineer Exam. It is particularly designed for Google Professional-Cloud-Network-Engineer exam and our Google specialists have created this Professional-Cloud-Network-Engineer Question Dumps observing the original Professional-Cloud-Network-Engineer exam.
ReplyDeleteyou have actually signified out some fantastic points, I similarly assume this s an extremely wonderful web site.온라인카지노
ReplyDeleteIt was an awesome post to be sure. I completely delighted in understanding it in my noon. Will without a doubt come and visit this blog all the more frequently.카지노사이트
ReplyDeleteThis post truly made my day. You can not imagine just how much time I had spent for this info! Thanks! Feel free to visit my website; 온라인카지노사이트
ReplyDeleteYour way of working is very great and cool. This article is very informative and helpful for a lot of people. Thanks for sharing and keep sharing. Feel free to visit my website; 온라인카지노사이트넷
ReplyDeleteAwesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! Feel free to visit my website; 바카라사이트닷컴
ReplyDeleteMmorpg Oyunları
ReplyDeleteinstagram takipçi satın al
tiktok jeton hilesi
tiktok jeton hilesi
antalya saç ekimi
referans kimliği nedir
instagram takipçi satın al
metin2 pvp serverlar
instagram takipçi satın al
Exams4sure is the best website for exam dumps. They have Mulesoft MCD-Level-1 Exam Dumps which are very helpful. I used them and passed my exam. I would definitely recommend them to others.
ReplyDeleteSmm panel
ReplyDeleteSMM PANEL
iş ilanları
instagram takipçi satın al
hirdavatciburada.com
Https://www.beyazesyateknikservisi.com.tr/
SERVİS
tiktok jeton hilesi
pendik beko klima servisi
ReplyDeletemaltepe lg klima servisi
kadıköy lg klima servisi
kartal toshiba klima servisi
ümraniye toshiba klima servisi
ümraniye beko klima servisi
çekmeköy samsung klima servisi
ataşehir samsung klima servisi
çekmeköy mitsubishi klima servisi
Good content. You write beautiful things.
ReplyDeletekorsan taksi
vbet
sportsbet
hacklink
sportsbet
mrbahis
vbet
taksi
mrbahis
Success Write content success. Thanks.
ReplyDeletecanlı poker siteleri
betpark
canlı slot siteleri
deneme bonusu
betturkey
kralbet
betmatik
maraş
ReplyDeletebursa
tokat
uşak
samsun
38O7
ağrı
ReplyDeletemuş
mersin
afyon
uşak
QNYN0
شركة مكافحة القوارض بالرياض
ReplyDeleteالقوارض