Data Science with Python Certification Statistical Analysis and Hypothesis Testing 1 — Questions and Answers
Question 1: What does a p-value less than 0.05 typically indicate in hypothesis testing?
- The null hypothesis is accepted
- There is strong evidence to reject the null hypothesis (Correct answer)
- The test is inconclusive
- The alternative hypothesis is false
Correct answer: There is strong evidence to reject the null hypothesis
A p-value below 0.05 indicates strong evidence against the null hypothesis, so it is rejected.
Question 2: Which Python library provides the `ttest_ind()` function for an independent samples t-test?
- numpy
- pandas
- scipy.stats (Correct answer)
- sklearn
Correct answer: scipy.stats
`scipy.stats.ttest_ind()` performs an independent samples t-test comparing means of two groups.
Question 3: What is the primary purpose of a chi-square test in data science?
- Testing the mean of a dataset
- Testing the relationship between categorical variables (Correct answer)
- Measuring correlation between continuous variables
- Computing variance of a distribution
Correct answer: Testing the relationship between categorical variables
A chi-square test assesses whether there is a statistically significant association between two categorical variables.
Question 4: Which measure of central tendency is most resistant to outliers?
- Mean
- Mode
- Median (Correct answer)
- Variance
Correct answer: Median
The median is resistant to outliers because it is based on rank position rather than the actual values of extremes.
Question 5: What does `scipy.stats.shapiro()` test for?
- Homogeneity of variance
- Independence of variables
- Normality of a distribution (Correct answer)
- Correlation between variables
Correct answer: Normality of a distribution
The Shapiro-Wilk test checks whether a sample comes from a normally distributed population.
Question 6: In Python, how do you compute the Pearson correlation coefficient between two arrays x and y using NumPy?
- np.correlation(x, y)
- np.corrcoef(x, y) (Correct answer)
- np.pearson(x, y)
- np.cov(x, y)
Correct answer: np.corrcoef(x, y)
`np.corrcoef(x, y)` returns the Pearson correlation matrix; the off-diagonal element [0,1] is the coefficient.
What does a p-value less than 0.05 typically indicate in hypothesis testing?