Generation

generate functionFri, 17 Mar 2023

Determine the required sample size 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 get_sample_size(error, variance, confidence): sqrt_variance = math.sqrt(variance) return math.ceil((error * math.sqrt(2 * (1 - confidence)) * sqrt_variance) / (error * error)) get_sample_size(0.02, 0.05, 0.95)

Questions about programming?Chat with your personal AI assistant