You will work out exactly where a poll with non-response points, measure its bias, and then run the poll many times to see that a large sample does not remove the bias.
The idea. A share of the population supports a plan. Supporters reply with chance and the others with chance . Among the replies, the share of supporters is . Here every share is a decimal between 0 and 1.
Your tasks.
reply_share(p, r_yes, r_no). Return the share of supporters among the replies.bias(p, r_yes, r_no). Return the reply share minus the true share.run_poll(asked, p, r_yes, r_no). For each person asked, decide at random whether the person supports the plan and whether the person replies. Return the share of supporters among the replies.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…