Blog Archives

Pseudo-Random vs. Random Numbers in R

November 25, 2011
By
Pseudo-Random vs. Random Numbers in R

Happy Thanksgiving, everyone. Earlier today, I found an interesting post from Bo Allen on pseudo-random vs random numbers, where the author uses a simple bitmap (heat map) to show that the rand function in PHP has a systematic pattern and compares these to truly random numbers obtained from random.org. The post’s results suggest that pseudo-randomness in PHP is

Read more »

Conway’s Game of Life in R with ggplot2 and animation

June 5, 2011
By
Conway’s Game of Life in R with ggplot2 and animation

In undergrad I had a computer science professor that piqued my interest in applied mathematics, beginning with Conway’s Game of Life. At first, the Game of Life (not the board game) appears to be quite simple — perhaps, too simple — but it has been widely explored and is useful for modeling systems over time.

Read more »

Converting a String to a Variable Name On-The-Fly and Vice-versa in R

December 28, 2010
By

Recently, I had a professor ask me how to take a string and convert it to an R variable name on-the-fly. One possible way is: x <- 42 eval(parse(text = "x")) [1] 42 Now, suppose we want to go the other way. The trick is just as simple: x <- 42 deparse(substitute(x)) [1] "x"

Read more »

Automatic Simulation Queueing in R

December 28, 2010
By

I spend much of my time writing R code for simulations to compare the supervised classification methods that I have developed with similar classifiers from the literature.  A large challenge is to determine which datasets (whether artificial/simulated or real) are interesting comparisons.  Even if we restricted ourselves to multivariate Gaussian data, there are a large

Read more »

Autocorrelation Matrix in R

December 25, 2010
By

I have been simulating a lot of data lately  with various covariance (correlation) structures, and one that I have been using is the autocorrelation (or autoregressive) structure, where there is a “lag” between variables. The matrix is a v-dimension matrix of the form $$\begin{bmatrix} 1 & \rho & \rho^2 & \dots & \rho^{v-1}\\ \rho &

Read more »