Module # 3 assignment

First, let's create the data sets Set#1 and Set#2:

set1 <- c(10, 2, 3, 2, 4, 2, 5)

set2 <- c(20, 12, 13, 12, 14, 12, 15)

 

Now, let's calculate the measures of central tendency for each set:

# Mean for Set#1 and Set#2

mean_set1 <- mean(set1)

mean_set2 <- mean(set2)

 

# Median for Set#1 and Set#2

median_set1 <- median(set1)

median_set2 <- median(set2)

 

# Mode for Set#1 and Set#2

mode_set1 <- as.numeric(names(sort(table(set1), decreasing = TRUE)[1]))

mode_set2 <- as.numeric(names(sort(table(set2), decreasing = TRUE)[1]))

 

Now, let's calculate the measures of variation for each set:

 

# Range for Set#1 and Set#2

range_set1 <- range(set1)

range_set2 <- range(set2)

 

# Interquartile Range (IQR) for Set#1 and Set#2

iqr_set1 <- IQR(set1)

iqr_set2 <- IQR(set2)

 

# Variance for Set#1 and Set#2

variance_set1 <- var(set1)

variance_set2 <- var(set2)

 

# Standard Deviation for Set#1 and Set#2

sd_set1 <- sd(set1)

sd_set2 <- sd(set2)

Set#2 generally has larger values than Set#1 for all central tendency measures (mean, median, mode).

Set#2 also has a wider range, larger IQR, and larger variance compared to Set#1.

This suggests that Set#2 has more spread and higher values compared to Set#1.


Comments

Popular posts from this blog

Final Project [LIS4317]

Module # 7 assignment (Visual Analytics)

Module # 8 Input/Output, string manipulation and plyr package