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 by round function.

import math def sample_size(delta, sigma, conf): z = 0.5 * (1 + conf) return math.ceil(2 * (z ** 2) * (sigma ** 2) / (delta ** 2)) sample_size(0.1, 0.3, 0.95)

Questions about programming?Chat with your personal AI assistant