Module 3 LIS 4273
> set1 <- c(10,2,3,2,4,2,5)
> set2 <- c(20,12,13,12,14,12,15)
> # Set 1
> mean(set1,trim = 0,na.rm = FALSE)
[1] 4
> median(set1,trim = 0,na.rm = FALSE)
[1] 3
> mode = function(){
+ return(names(sort(-table(set1)))[1])
+ }
> mode()
[1] "2"
> sd(set1,na.rm = FALSE)
[1] 2.886751
> range(set1,trim = 0,na.rm = FALSE)
[1] 0 10
> quantile(set1,trim = 0,na.rm = FALSE)
0% 25% 50% 75% 100%
2.0 2.0 3.0 4.5 10.0
> var(set1)
[1] 8.333333
> sd(set1,na.rm = TRUE)/mean(set1,na.rm = TRUE)*100
[1] 72.16878
> summary(set1)
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.0 2.0 3.0 4.0 4.5 10.0
> # Set 2
> mean(set2,trim = 0,na.rm = FALSE)
[1] 14
> median(set2,trim = 0,na.rm = FALSE)
[1] 13
> mode = function(){
+ return(names(sort(-table(set2)))[1])
+ }
> mode()
[1] "12"
> sd(set2,na.rm = FALSE)
[1] 2.886751
> range(set2,trim = 0,na.rm = FALSE)
[1] 0 20
> quantile(set2,trim = 0,na.rm = FALSE)
0% 25% 50% 75% 100%
12.0 12.0 13.0 14.5 20.0
> var(set2)
[1] 8.333333
> sd(set2,na.rm = TRUE)/mean(set2,na.rm = TRUE)*100
[1] 20.61965
> summary(set2)
Min. 1st Qu. Median Mean 3rd Qu. Max.
12.0 12.0 13.0 14.0 14.5 20.0
The primary differences between these two sets of data lies in their measures of central tendency. Set #2 has higher values for mean (14 vs. 4), median (13 vs. 3), and mode (12 vs. 2) than set #1. That indicates that set #2 data is larger. The measure of variation is very similar for both sets. Both have a range of 8, a variance of around 8.33, and a standard deviation of around 2.89. This suggests that the spread of data points around their means are very similar for both sets.
Comments
Post a Comment