# Posts Tagged ‘ computer ’

## Variable probability Bernoulli outcomes – Fast and Slow

November 1, 2012
By

I am working on a project that requires the generation of Bernoulli outcomes. Typically, I would go about this using the built in sample() function like so: This works great and is fast, even for large n. Problem is, I want to generate each sample with its own unique probability. Seems straight forward enough, I

## How do I Create the Identity Matrix in R?

June 27, 2012
By

I googled for this once upon a time and nothing came up. Hopefully this saves someone ten minutes of digging about in the documentation. You make identity matrices with the keyword diag, and the number of dimensions in parentheses. > diag(3) [,...

## An unabashedly narcissistic data analysis of my own tweets. The…

April 2, 2012
By

pie( table( whence.i.tweet )) qplot( whence ) + coord_polar() pie( log( table( whence )))+RColorBrewer ggplot (see below) plot( density( tweets.len )) qplot(... stat="density") + geom_density qplot(...stat="bin") + geom_text(...) tweeple tweep...

## CPU and GPU trends over time

January 25, 2011
By

GPUs seem to be all the rage these days. At the last Bayesian Valencia meeting, Chris Holmes gave a nice talk on how GPUs could be leveraged for statistical computing. Recently Christian Robert arXived a paper with parallel computing firmly in mind. In two weeks time I’m giving an internal seminar on using GPUs for

## Random variable generation (Pt 3 of 3)

January 12, 2011
By
$Random variable generation (Pt 3 of 3)$

Ratio-of-uniforms This post is based on chapter 1.4.3 of Advanced Markov Chain Monte Carlo.  Previous posts on this book can be found via the  AMCMC tag. The ratio-of-uniforms was initially developed by Kinderman and Monahan (1977) and can be used for generating random numbers from many standard distributions. Essentially we transform the random variable of

## Installing rJava on Ubuntu

October 20, 2010
By

I had some troubles installing rJava on Ubuntu. The easiest solution I found was installing from the command line using: Then it worked without any problems.

## Transitions and transversions in R

January 5, 2010
By

A couple of months ago I wrote the following R function to calculate the number of transitions and transversions between DNA sequences in an alignment. The function is fairly slow (an alignment of ~100 sequences, 800 bp in length takes around 30 second...

## Colour matching feature in R

December 8, 2009
By

I love R. It is an open-source statistical programming language that I found reasonably easy to learn, and find it incredibly versatile and useful. Because it's open-source anyone can contribute to it, and there are a huge number of packages that exten...