Confidence Interval for Population Mean

Statistical Inference DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Confidence Intervals for the Population Mean, Standard Error, Degrees of Freedom, Critical Values, Margin of Error, Confidence Level, Probability, Inferential Statistics, Calculus, Linear Algebra, Data Analysis, Sampling Distributions, Hypothesis Testing, Point Estimation, Central Limit Theorem, Error Analysis.

Write a function that calculates the confidence interval for a population mean given a list of sample data, the desired confidence level (e.g., 0.95), and whether the population standard deviation is known. Assume the population standard deviation is unknown unless specified otherwise. Use the t distribution for unknown sigma cases.