Statistical analysis libraries
Doing the path's calculations in Python: scipy.stats (quantiles, t.interval, t-tests, chi-squared), statsmodels for a proportion's interval, pandas for the contingency table; the R equivalents are named.
- 22 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
- Understand
A few cards from the deck
scipy.stats: what is it?
Show the answer
A Python scientific computing module that provides probability distributions (norm, t, chi2) and statistical tests (ttest_1samp, ttest_ind, ttest_rel, chisquare, chi2_contingency).
Each distribution offers
ppf(quantile),cdf(cumulative probability) andsf(tail). Each test returns the statistic and the p-value.What does this program print?
```python
from scipy import stats
print(round(stats.norm.ppf(0.975), 2))`1.961.640.982.58
Show the answer
1.96ppf(0.975)leaves 2.5% of the normal distribution on the right: it is the quantile of the two-sided 95% interval. 1.64 isppf(0.95)and 2.58 isppf(0.995).In R, the function … runs the t-tests, … the chi-squared test and … tests a proportion.
Show the answer
In R, the function t.test runs the t-tests, chisq.test the chi-squared test and prop.test tests a proportion.
t.test(x, y, paired = TRUE)corresponds to scipy'sttest_rel. R gathers under one name what scipy splits into several functions.statsmodels: what is it?
Show the answer
A Python statistical analysis library, offering among other things the confidence interval of a proportion with proportion_confint.
proportion_confint(successes, total, alpha=0.05, method='normal')returns both bounds. Themethodoption picks the formula,'normal'being the one in the course.The same 30 pages are measured before and after an optimisation, and the script runs
stats.ttest_ind(before, after). Which fix is right?stats.ttest_1samp(before, after)stats.chisquare(before, after)stats.ttest_rel(before, after), paired seriesstats.ttest_ind(before, after, equal_var=False)
Show the answer
stats.ttest_rel(before, after), paired seriesttest_reltests page-by-page differences.equal_var=Falsefixes another problem (unequal variances between two distinct groups).ttest_1sampexpects a value, not a second series.