
Problem 1 is about the inferences for "the difference of two population proportions".
Please take a look at the Day18 note on the web.
Our test statistic would be based on the two sample proportions.
Your comments are more relevant and helpful for the problem 2 and 3.
If we want to make inferences for "the difference of two population means",
then we need to calculate the both S1^2 and S2^2.
Those are just the sample variances,
so we can use "var()" command in RStudio.
In addition, if we can assume the two variances are equivalent,
then Sp^2 needs to be calculated by the formula you provided.
