Newborn Age vs Weight in R-statistical Program.

Follow My code

NewBorn Age in Months vs Weight in lbs

> newbornAgeMonths=c(0,1,2,3,4,5,6,7,8,9,10,11)
> newbornWeightMonths=c(7.16,9.15,10.91,12.56,14,15.43,16.53,17.64,18.74,19.62,20.28,21.05)
> mean(newbornWeightMonths)
[1] 15.25583
> cor(newbornAgeMonths,newbornWeightMonths)
[1] 0.9883767
> plot(newbornAgeMonths,newbornWeightMonths)
> table=rbind(newbornAgeMonths,newbornWeightMonths)
> table
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
newbornAgeMonths 0.00 1.00 2.00 3.00 4 5.00 6.00 7.00 8.00 9.00
newbornWeightMonths 7.16 9.15 10.91 12.56 14 15.43 16.53 17.64 18.74 19.62
[,11] [,12]
newbornAgeMonths 10.00 11.00
newbornWeightMonths 20.28 21.05
> tablec=cbind(newbornAgeMonths,newbornWeightMonths)
> tablec
newbornAgeMonths newbornWeightMonths
[1,] 0 7.16
[2,] 1 9.15
[3,] 2 10.91
[4,] 3 12.56
[5,] 4 14.00
[6,] 5 15.43
[7,] 6 16.53
[8,] 7 17.64
[9,] 8 18.74
[10,] 9 19.62
[11,] 10 20.28
[12,] 11 21.05
> ?cor
> cor(newbornAgeMonths,newbornWeightMonths, use = “everything”,
+ method = c(“pearson”, “kendall”, “spearman”))
[1] 0.9883767
> cor(newbornAgeMonths,newbornWeightMonths, use = “everything”,
+ method = c(“kendall”))
[1] 1
> cor(newbornAgeMonths,newbornWeightMonths, use = “everything”,
+ method = c(“spearman”)
+
+ )
[1] 1
> cor(newbornAgeMonths,newbornWeightMonths, use = “everything”,
+ method = c(“pearson”))
[1] 0.9883767

Leave a Comment

Your email address will not be published. Required fields are marked *