Generation

generate functionFri, 17 Mar 2023

Write a function that will determine the size of the necessary sample for the study if the following parameters are known: - error (delta); - variance (sigsqr); - Confidence level (conf). Round up the answer to a whole number.

import math def sample_size(delta, sigsqr, conf): return math.ceil( (sigsqr * (math.log(1 / (1 - conf)) / delta)**2) / 2 ) sample_size(0.05, 0.02, 0.95)

Questions about programming?Chat with your personal AI assistant