def find_median(dataset):
sorted_list = sorted(dataset)
length = len(sorted_list)
if length % 2 == 0:
return (sorted_list[length // 2 - 1] + sorted_list[length // 2]) / 2
else:
return sorted_list[length // 2]
def calculate_variance(data):
mean = sum(data) / len(data)
return sum((x - mean) ** 2 for x in data) / len(data)
def calculate_std_deviation(data):
variance = calculate_variance(data)
return variance ** 0.5
def calculate_correlation(x, y):
mean_x = sum(x) / len(x)
mean_y = sum(y) / len(y)
numerator = sum((xi - mean_x) * (yi - mean_y) for xi, yi in zip(x, y))
denominator = (sum((xi - mean_x) ** 2 for xi in x) * sum((yi - mean_y) ** 2 for yi in y)) ** 0.5
return numerator / denominator if denominator else 0