I’ve posted quite a few code snippets over time, mainly in SPSS. This page is a brief overview for me to find my stuff. If you are looking for something and a link does not work, let me know. Also I have a few in here that do not have blog posts! So extras if you will.
This page is a current work in progress. Will continuing updating slowly over time.
SPSS Macros and Code Snippets
Statistical Oriented Macros
- Aoristic Macro (Blog Post 1, Blog Post 2) (Macro)
- ROC and Precision Recall Curves (Blog Post) (Macro)
- Restricted Cubic Splines (Blog Post) (Macro)
- Negative Binomial Predictions (Blog Post)
- Generating Negative Binomial Random Variables (Blog Post)
- Randomly sample multinomial probabilities (Macro)
- GINI index and other diversity indexes (Macro)
- Funnel Chart and empirical Bayes shrinkage for rates (Blog Post Funnel Chart, Blog Post Shrinkage) (Macro)
- Propensity Score Balance Stats (post FUZZY) – (Blog Post) (Macro)
- Runs test for multiple groups – (Cross Validated Post) (Macro)
Data Manipulation
- Time and Panel Fill (Blog Post) (Macro)
- EdgeList from long data (Blog Post) (Macro)
- American Community Survey !Updated! (Blog Post)
- Correlation Pairs (Blog Post)
- Bezier Curves (and circular stat helpers) (Blog Post) (Macro)
- Generate Permutations of a Columns (Macro)
- Cut continuous variable into bins (Macro)
Graphs
- Personal Chart Template (Blog Post) (current chart template)
- Treemap (Blog Post) (Macro)
- Spineplot (Blog Post) (Macro)
- Equal Probability Histogram (Blog Post)
- Ellipses (Blog Post) (Macro)
- Stacked Intervals (Blog Post)
- Post clip PDF (ToDo!)
- Heatmaps (Blog Post)
- Side by side charts (Blog Post)
- Panel data with many lines (Blog Post)
- Smooth temporal crime patterns and seasonal charts (Blog Post)
- Shape, color and pattern constants in SPSS (Blog Post)
- Overlapping error bars (Blog Post)
- Maps in inline GPL (Blog Post)
- Continuous color ramps (Blog Post)
- Labeling tricks (Blog Post)
Python in SPSS Examples
- Connected Components in Graphs (Blog Post)
- Custom distance function for FUZZY (Blog Post)
- SPSS data to python data (Blog Post)
- Python data to SPSS data (Blog Post)
- Graph queries using networkX and SPSSINC TRANS (Blog Post)
R in SPSS Examples
- Group based trajectory models in SPSS using R (Blog Post)
- Using ggmap to plot crime data (Blog Post)
Python Code Snippets
- Laplacian Centrality (Blog Post)
- Google Geocoding API (Blog Post)
- Google Places API (Blog Post 1, Blog Post 2, Code Snippet)
- Google Distance API (Blog Post)
- Google Streetview API (with a specific address) (Blog Post)
- Google Streetview API (drawing images along a street) (Blog Post, Python Functions)
- Google Reverse Geocoding API (for neighborhood tags) (Blog Post)
- ESRI Geo API for New York State (Blog Post)
- KDTrees (Blog Post)
- emailing (Blog Post)
- American Community Survey data to Pandas (Blog Post)
- dominant set in networkX (ToDo!)
- Spatial join points to polygons (Blog Post)
- Scraping PDFs online (Blog Post)
- Near-repeats in space-time (Blog Post)
- Poisson E-test (Python functions)
- Import/Export CSV files (Python functions)
- Download PDFs from CiteULike using selenium (Blog Post, Python Functions)
R Code Snippets
- Ripleys K for fixed areas (Blog Post)
- One sided line buffers using rgeos (Blog Post)
- Graphs for group based trajectory (Blog Post)
- KDE estimates for logistic predictions to probability scale (Blog Post)
- Small Sample test statistics (Blog Post) (R code) (Benford analysis example blog post)
- ggplot rootogram and mixed scales (Blog Post, StackOverflow example)
- inverse distance hacking in spatstat and inline C code (Blog Post) (R functions)
- near-repeats in space-time (Blog Post)
- Poisson E-test (R functions)
- Checking Poisson distribution (R function)
- SPPT test (Wouter’s GitHub page)