x=c(23,27,28,28,29,30,31,33,35,36) y=c(18,20,22,27,21,29,27,29,28,29) cor(x,y) cor(x,y,method="pearson") cor(x,y,method="spearman") #find rank coreelation coefficient of the following x=c(44,49,52,54,47,76,65,60,63,58,50,67) y=c(48,55,45,60,43,80,58,50,77,46,47,65) cor(x,y,method="spearman") cor(x,y,method="pearson") x=c(175,168,170,171,169,165,165,160,180,186)#height y=c(80,68,72,75,70,65,62,60,85,90)#weight #using inbuilt function cor(x,y) m1=lm(formula=x~y) m2=lm(formula=y~x) m1 m2 #calculate height when weight =65 h1=(65*0.7662)+115.2002 h1 #calculate weight when height=170 w1=170*1.266-143.696 w1 #usin formula #cov(x,y)/sdx,sdy var(x) var(y) a=sqrt(var(x)) b=sqrt(var(y)) r=cov(x,y)/(a*b) r
To embed this project on your website, copy the following code and paste it into your website's HTML: