Two-Sample T-Test Implementation

Statistical Inference DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding and implementing the Welch's Two-Sample T-Test from scratch, Welch-Satterthwaite Equation, Standard Error of the Difference, Pooled vs Unpooled Variance, Two-tailed P-value computation, T-distribution CDF, Probability Theory, Inferential Statistics, Hypothesis Testing, Descriptive Statistics, Linear Algebra, Null Hypothesis Significance Testing, Sampling Distributions, Degrees of Freedom Calculation, Variance Estimation, Confidence Intervals.

Implement a function 'two sample ttest(group1, group2)' that calculates the t statistic and the p value for an independent two sample t test (Welch's t test). Assume unequal variances. Return a tuple containing the (t statistic, p value). Use the scipy.stats library for the cumulative distribution function to determine the p value.