You will write four functions: the coefficient of variation, the new mean and spread after every value is changed, and the combined mean and standard deviation of two groups. The checker tests them on data with known answers, and on a case where the two groups have equal means.
The idea. For a change , the mean becomes and the standard deviation becomes . Two groups together have a weighted mean, and a combined variance that adds the spread inside each group and the spread of the group means.
Your tasks.
cv(mean, sd). Give the answer in percent.changed(mean, sd, a, b). Return the new mean and the new standard deviation as a pair.combined_mean(n1, m1, n2, m2).combined_sd(n1, m1, s1, n2, m2, s2). Use the combined mean to find and .Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…