Descriptive Statistics
✕Central Tendency
Question 1 of 2
- Write a function
calc_meanthat takes a list of numbers and returns mean. - Write a function
calc_medianthat takes a list of numbers and returns median. - Write a function
calc_modethat takes a list of numbers and returns mode. - Test functions with the dataset
[2, 1, 2, 5, 100]. Verify mean =22, median =2, mode =2. - Write a function
calc_percentilethat takes a list of numbers and a percentile value (0-100). Returns the corresponding pth percentile value i.e.[p * (n+1) / 100]th itemin sorted data. - Write a function
calc_quartilesthat takes a list of numbers and returnsQ1,Q2,Q3. Reuse above function for this.
- Write a function
Dispersion
Question 2 of 2
- Write a function
calc_rangethat takes a list of numbers and returns range (L -S). - Write a function
calc_covariancethat takes two lists of numbers and returns covariance. - Write a function
calc_variancethat takes a list of numbers and returns variance. - Write a function
calc_correlationthat takes two lists of numbers and return correlation. - Test functions with the datasets X =
[5, 20, 95]and Y =[10, 30, 50]. Verify range(X) =90, covariance =600, variance(X) =4650, correlation =0.54. - Write a function
calc_bmithat takes height (in meters) and weight (in kg) and returns BMI.bmi = weight / (height * height).
- Write a function
