Publications by apeescape
Lotka-Volterra model ~ intro
So many know about the Lotka-Volterra model (i.e. the predator-prey model) in ecology. This model portrays two species, the predator (y) and the prey (x), interacting each other in limited space. The prey grows at a linear rate () and gets eaten by the predator at the rate of (). The predator gains a certain amount vitality by eating the prey at...
1475 sym R (534 sym/1 pcs) 26 img
R Tools for Dynamical Systems ~ R pplane to draw phase planes
MATLAB has a nice program called pplane that draws phase planes of differential equations models. pplane on MATLAB is an elaborate program with an interactive GUI where you can just type the model to draw the phase planes. The rest you fidget by clicking (to grab the initial conditions) and it draws the dynamics automatically. As far as I know, R...
3132 sym R (1192 sym/1 pcs) 16 img
Cherry Picking to Generalize ~ NASA Global Temperature Trends
The relatively (to this decade) cool 2008 global temperatures spurred talks of a warming pause, or even global cooling. The claim usually comes from people who cherry picked either data sets and(!)/or start and end points of the global temperature trends to back up their allegation. The blogosphere already has a lot on this: Skeptical Science su...
3420 sym R (2046 sym/1 pcs) 20 img
Cherry Picking to Generalize ~ NASA Global Temperature Trends ~ enhanced w/ ggplot2
In a prior article, I tried to visualize the linear global temperatures trends for a grid of start and end years. The visual I created was confusing in that the specification of color scale was interdependent with the data values. I wanted a blue -> white -> red scale of the temperatures indicating cool -> neutral -> warm temperatures, with the e...
1677 sym R (2648 sym/1 pcs) 18 img
MLB Baseball Pitching Matchups ~ downloading pitch f/x data using the XML package in R [updatedx6]
Update x6 (Jul 27): so I guess people want pitch counts. The data @ MLB seems to only give the pitch count of the end result and the strikes/balls/outs of the particular pitch. Of course you can combine them to get the pitch count. Stupid WordPress comments strip out necessary HTML to properly display code, therefore, I post below! pitcher.Lince ...
3766 sym R (9479 sym/5 pcs) 18 img
MLB Baseball Pitching Matchups ~ manipulating pitch f/x data using the RMySQL package in R
After downloading some pitch f/x data using my R script, we can finally have some fun. But because the pitch f/x data is very elaborate, R can easily get overwhelmed by copying the dataset back and forth in memory, as you manipulate the data. So the natural progression is to use relational database systems. Here, I show a simple example of using ...
2092 sym R (3969 sym/5 pcs) 18 img
MLB Baseball Pitching Matchups ~ grabbing pitcher and/or batter codes by specify game date using R XML
MLB Gameday stores its game data in XML format, with the players denoted in ID numbers. To find out who is who, the codes are stored in pitchers.xml or batters.xml of each game. My DownloadPitchFX.R script can download the ID numbers, but it doesn’t look to see who the ID is because of the extra processing time. But to use the data (say in RMyS...
1466 sym R (7443 sym/2 pcs) 16 img
R Tools for Dynamical Systems ~ bifurcation plot in R for system of ODEs
As per request, here is the code that I wrote to draw bifurcation plots in R. Bifurcation diagrams for discrete maps can be done using this code by James Jones. It is a little easier since approximation is not needed. In the following code, I used the deSolve library to draw bifurcation diagrams for a system of ODEs (continuous). You basically ne...
1061 sym R (1235 sym/1 pcs) 18 img
Plot Multiple Time Series using the flow / inkblot / river / ribbon / volcano / hourglass / area / whatchamacallit plots ~ blue whale catch per country w/ ggplot2
Ever since I first looked at this NYT visualization by Amanda Cox, I’ve always wanted to reproduce this in R. This is a plot that stacks multiple time series onto one another, with the width of the river/ribbon/hourglass representing the strength at each time. The NYT article used box office revenue as the width of the river. It’s also an int...
1880 sym R (1997 sym/1 pcs) 18 img
Area Plots with Intensity Coloring ~ el nino SST anomalies w/ ggplot2
I see many economy indicator graphs that show emphasis by shading in the curve under the area (while x-axis is time). The shade is stronger at higher values (example). I did this in R below (ggplot2). This was a little more difficult that I’d expected. The color gradients are good to color each individual points depending on the strength, but n...
1384 sym R (1554 sym/1 pcs) 20 img