Here are my results from the assignment:
x <- c(10, 2, 3, 2, 4, 2, 5)
y <-c(20, 12, 13, 12, 14, 12, 15)
mean(x)
## [1] 4
median(x)
## [1] 3
mode(x)
## [1] "numeric"
mean(y)
## [1] 14
median(y)
## [1] 13
mode(y)
## [1] "numeric"
range(x)
## [1] 2 10
range(y)
## [1] 12 20
sd(x)
## [1] 2.886751
sd(y)
## [1] 2.886751
quantile(x)
## 0% 25% 50% 75% 100%
## 2.0 2.0 3.0 4.5 10.0
quantile(y)
## 0% 25% 50% 75% 100%
## 12.0 12.0 13.0 14.5 20.0
CV <- function(mean, sd){(sd/mean)*100}
CV(mean(x), sd(x))
## [1] 72.16878
CV(mean(y), sd(y))
## [1] 20.61965
summary(x)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.0 2.0 3.0 4.0 4.5 10.0
summary(y)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.0 12.0 13.0 14.0 14.5 20.0
When comparing the two sets of data, the data from "y" is always 10 higher than the data from "x" in every outcome.
Comments
Post a Comment