Quick Note: When you’re bash scripting and you need to pipe some text into some process, you can use
echo with the
-n flag to suppress the
echo‘s complimentary endline , or you can use
printf, but using
printf is more portable. Some machines implement
echo differently and don’t support the
-n flag. I found this advice and a longer explanation at this message board.
I heard about a new (to me) tool for viewing shapefiles on this site. It required the installation of
basemap which is a part of
matplotlib, but the installation turned out to be a little tricky. I found a solution at the blog, I Lessen Data, which pointed me to another interesting post on mapping, So You’d Like to Make a Map Using Python.
Continue reading Viewing Shapefiles Using Basemap in Python
I got the following error when trying to use
package ‘gstat’ is available as a source package but not as a binary
Warning in install.packages :
package ‘gstat’ is not available (for R version 3.1.1)
Continue reading Installing gstat for R on a Mac
This is a follow up on my previous post, in this post I will take a closer look at using ARIMA models in R using the same data set.
Continue reading ARIMA Forecasting in R
A friend recently made a prediction about the price of oil for the next three months. I thought I would perform some time series forecasting on the West Texas Intermediate prices and see if his numbers were reasonable from a dumb-numbers canned-forecasting perspective. I’m not making the claim that one can reasonably and accurately forecast oil prices with traditional time series techniques. (That’s bogus.) I’m simply doing this to learn more about forecasting.
Monthly petroleum prices can be found at the Energy Information Administration. Ever relevant, Wikipedia has a great write-up on recent trends in oil prices. Also, there is this Times article on the spike and drop in 2008 which had this apt summary,
[Oil prices are] the product of an extremely volatile mixture of speculation, oil production, weather, government policies, the global economy, the number of miles the average American is driving in any given week and so on. But the daily price is actually set — or discovered, in economic parlance — on the futures exchange.
Continue reading Time Series Forecasting in Python and R
In this post I’ll provide some code for parsing an
.eml file and extracting images. I was able to perfrom the parsing with the help of a great blog post I found here. Turning the blocks of ASCII letters back into JPEGs and PNGs took some work.
Continue reading Extracting Images from .eml Files
In this post I’ll discuss compound Poisson processes, which I read about in the final chapter of Hassett and Stewart’s Probability for Risk Management last night. These model a stochastic process where at regular intervals (months, quarters, etc.) some number of events occur according to a Poisson process with rate , and the intensity of each event is determined independently by another other distribution.
Continue reading Compound Poisson Processes
This is more of a personal note regarding the
- To create a sparse image:
$ hdiutil create NAME -volname NAME -type SPARSE -fs hfs+j
$ hdiutil attach NAME.sparseimage
- To add data to the drive:
$ mv data.txt /Volumes/NAME
$ hdiutil detach /Volumes/NAME
Then, if we delete the
NAME.sparseimage file, it’s gone forever and ever.
In this post I’ll cover testing with unittest and nose. A really good overview of testing and testing tools is provided at the Hitchhiker’s Guide to Python.
Continue reading Testing in Python