#!/usr/bin/env python # coding: utf-8 # # StatWrap # # StatWrap is a Python package I've written for this course. Find the [documentation here](https://statwrap.readthedocs.io/en/latest/index.html). # # I simplify other packages and use function names that match the conventions of {cite}`freedman2007statistics` or Google Sheets to make it easier to switch from the book to coding. Other packages use defaults that might clash with the book (e.g. SD vs SD+). Using StatWrap prevents accidentally wading into those complications. # # If you pursue more advanced study of statistics or related fields, you will never use StatWrap again, but it's a good place to start if you already find coding to be overwhelming enough. # # ## Using StatWrap # # StatWrap is not installed in Google Colab by default. To install and use statwrap, run `!pip install statwrap`. This will produce a lot of output you can ignore. Then you can import the package like in the code below. # # #
# #
# #
# In[1]: get_ipython().system('pip install statwrap') import statwrap get_ipython().run_line_magic('use_fpp', '') get_ipython().run_line_magic('use_sheets', '') # Here's what the lines above do. # # 1. This installs statwrap. This isn't permanent on Google Colab, so you'll have to run this for every new session. # 2. This imports statwrap. # 3. This loads the FPP module, which includes functions likes [`sd`](https://statwrap.readthedocs.io/en/latest/fpp.html#statwrap.fpp.sd) to calculate the standard deviation of a list of numbers using the syntax `sd(1,2,3)`. You *don't* have to write `statwrap.fpp.sd(1,2,3)` if you run this line. # 4. Like the third line, this loads the Google Sheets module. This module includes functions like [`stdevp`](https://statwrap.readthedocs.io/en/latest/sheets.html#statwrap.sheets.stdevp) to match the `STDEVP` function in Google Sheets and Excel. # In[2]: sd(1, 2, 3) # In[3]: stdevp(1, 2, 3) # # Example Catalog # # Below are some minimal working examples that use StatWrap. # # 1. [Histograms](https://colab.research.google.com/drive/1ws2kTH_9KX-dE9ZBUPObTpEYQmjUukOy?usp=sharing)