In this post I’ll discuss how to use Python and R to calculate the Pearson Chi-Squared Test for goodness of fit. The chi-squared test for goodness of fit determines how well categorical variables fit some distribution. We assume that the categories are mutually exclusive, and completely cover the sample space. That means that the everything we can think of fits into exactly one category, with no exceptions. For example, suppose we flip a coin to determine if it is fair. The outcomes of this experiment fit into exactly two categories, head and tails. The same goes for rolling a die to determine its fairness; rolls of the die will result in (exactly) one of (exactly) six outcomes or categories. This test is only meaningful with mutually exclusive categories.
Continue reading The Pearson Chi-Squared Test with Python and R →
Suppose you have a package that imports a lot of weird modules and you’d like to share this package without forcing end users to install a bunch of stuff. You can bundle this into a PEX file and everyone will live happily ever after.
Continue reading Working with Python PEX Files →
In this post I’ll describe a simple (read: limited) Markdown to LaTeX converter. This will cover up to three levels of headings, ordered, and unordered lists.
Continue reading Writing a Markdown to LaTeX Converter in Python →
In this post I’ll discuss how to make simple flowcharts in LaTeX using TikZ. Probably the best collection of TikZ examples can be found at TeXample.net, but there are other helpful examples like these two PDFs, here and here. In case you’re wondering, TikZ is a recursive acronym “TikZ ist kein Zeichenprogramm,” a reminder (in German) that it is not an interactive drawing program.
Continue reading Creating a Flowchart with TikZ and LaTeX →
In this post I’ll describe how to get LaTeX up and running on a Mac. First of all, it’s not as easy as just going,
brew install latex, and then saying,
pdflatex kapow.tex, but it’s not as hard as doing literally anything on Windows either.
Continue reading Getting LaTeX working on a Mac →
This post is mostly for personal reference because I have to keep looking up how to use the
tar utility. Here, I’ll cover what tar files are and how to read and write them. The name “
tar” is short for Tape ARchive. The
tar utility is used to write a set of files and/or directories to a single file that can be easily transported and then un-tar-ed.
Continue reading Working with TAR Files →
In this post I’ll discuss how to plot data points on a shapefile. In a previous post I discussed how to install basemap using pip, the package manager for Python. Since
basemap is an extension of
matplotlib, we have a lot of familiar plotting functions and options at our disposal. Of particular importance is the ability to use projection data in plotting the shapefile, and plotting the data points.
Continue reading Adding Data Points to Shapefiles →