# March 2010

### Validating credit card numbers in SAS

March 16, 2010 | 0 Comments

Major credit card issuing networks (including Visa, MasterCard, Discover, and American Express) allow simple credit card number validation using the Luhn Algorithm (also called the “modulus 10″ or “mod 10″ algorithm). The following code demonstrates an implementation in SAS. The code also validates the credit card number by length and by checking ...

### In search of a random gamma variate…

March 16, 2010 | 0 Comments

One of the most common exersices given to Statistical Computing,Simulation or relevant classes is the generation of random numbers from a gamma distribution. At first this might seem straightforward in terms of the lifesaving relation that exponential and gamma random variables share. So, it’s easy to get a ...

### Nutritional supplements, ranked

March 16, 2010 | 0 Comments

One of my favourite shows on TV right now is The Big Bang Theory. For those who haven't seen it: it's like Friends, except instead of New York yuppies, it's PhD physicists and engineers at CalTech. It's nice to see geeks and smart people be the focus (rather than the ... [Read more...]

### DICOM-to-NIfTI Conversion

March 16, 2010 | 0 Comments

Now that the two packages oro.dicom and oro.nifti have been released, we can put them together and perform the much sought after conversion from DICOM format to NIfTI format (entirely in R).  Why?  Because DICOM is the international "standard" for medical imaging data coming off the scanners, but ... [Read more...]

### Rcpp 0.7.10

March 15, 2010 | 0 Comments

Versions 0.7.7 to 0.7.9 of Rcpp contained a bug: protecting paths with quotes was supposed to help with Windows builds, but did the opposite at least in 'backticks mode' for getting path and/or library information. Using the shQuote() function instead... [Read more...]

### Solving the rectangle puzzle

March 15, 2010 | 0 Comments

Given the wrong solution provided in Le Monde and comments from readers, I went to look a bit further on the Web for generic solutions to the rectangle problem. The most satisfactory version I have found so far is Mendelsohn’s in Mathematics Magazine, which gives as the maximal number ... [Read more...]

### Robert Brown and Pollen Particles

March 15, 2010 | 0 Comments

In 1827, the botanist Robert Brown was studying pollen particles as they floated in water. When viewed through a microscope, he observed that the particles seemed to move around as if the were alive. Although he couldn’t have known at the time, the seemingly random motion was caused by the ...

### Visualizing droughts with R

March 15, 2010 | 0 Comments

Physicist and weather scientist Joe Wheatley used R to design and create a useful visual representation of how drought affects a region over long time-scales. Instead of charting absolute rainfall (or lack thereof), he instead charts the Standardized Precipitation Index (SPI), where extreme values (above 2 or below -2) indicate extreme ... [Read more...]

### Weighting model fit with ctree in party

March 15, 2010 | 0 Comments

Conditional inference trees (ctree) in package party allows weighting which is useful when one classification outcome is more important than another. Useful examples are not difficult to imagine: in a marketing direct mailing, a false positive (non-res...

### The Price of Calculation

March 15, 2010 | 0 Comments

In a world in which the price of calculation continues to decrease rapidly, but the price of theorem proving continues to hold steady or increase, elementary economics indicates that we ought to spend a larger and larger fraction of our time on calculation.1 Over the next ten years, I hope ... [Read more...]

### Example 7.27: probability question reconsidered

March 15, 2010 | 0 Comments

In Example 7.26, we considered a problem, from the xkcd blog:Suppose I choose two (different) real numbers, by any process I choose. Then I select one at random (p= .5) to show Nick. Nick must guess whether the other is smaller or larger. Being righ...

### R Tutorial Series: R Beginner’s Guide and R Bloggers Updates

March 15, 2010 | 0 Comments

1/1/2011 Update: Tal Galili wrote an article that revisits the first year of R-Bloggers and this post was listed as one of the top 14. Therefore, I decided to make a small update to each section. I start by describing the initial series of tutorials th...

### t-walk on the banana side

March 14, 2010 | 0 Comments

Following my remarks on the t-walk algorithm in the recent A General Purpose Sampling Algorithm for Continuous Distributions, published by Christen and Fox in Bayesian Analysis that acts like a general purpose MCMC algorithm, Darren Wraith tested it on the generic (10 dimension) banana target we used in the cosmology paper. ...

### \pi day!

March 14, 2010 | 0 Comments

It’s π-day today so we gonna have a little fun today with Buffon’s needle and of course R. A well known approximation to the value of $latex \pi$ is the experiment tha Buffon performed using a needle of length,$latex l$. What I do in the next is ... [Read more...]

March 13, 2010 | 0 Comments

Someone on the R mailing list (link) asked: how can you easily (daily) collect data from many people into a spreadsheet and then analyse it using R. The answer people gave to it where on various ways of using excel.  But excel files (at least for now),  are not “on ... [Read more...]

### Rosetta language popularity

March 13, 2010 | 0 Comments

Rosetta Code is a community wiki which presents how to solve various programming tasks by different programming languages. Thus, it serves as a dictionary between programming languages, but also as cookbook of programming recipes for a specific language.One unsolved (until today) programming task for R was to rank languages ... [Read more...]

### Rcpp 0.7.9

March 12, 2010 | 0 Comments

Version 0.7.8 of Rcpp, released just a few days ago contained a nasty bug or two which we noticed when trying to built the initial release of RcppArmadillo on 64-bit platforms. So a quick bug-fix release 0.7.9 is now in Debian and should be on CRA... [Read more...]

### Wrong puzzle of the week [w10]?!

March 12, 2010 | 0 Comments

In the weekend supplement to Le Monde, the solution of the rectangle puzzle is given as 32 black squares. I am thus… puzzled!, since my R program there provides a 34 square solution. Am I missing a hidden rectangle in the above?! Given that the solution in Le Monde is not based ...

### R workshops in Vancouver

March 12, 2010 | 0 Comments

Isabella Ghement of the Ghement Statistical Consulting Company is presenting two R workshops in Vancouver, British Columbia: "An Introduction to the Statistical Software Package R" (April 15-16,2010; 8:30am-4:30pm; BCIT; Vancouver) "Advanced Statistical Modeling Using the Statistical Software Package R" (May 20-21, 2010; 8:30am-4:30pm; BCIT; Vancouver) Click the links for ... [Read more...]

### Modified Donchian Band Trend Follower using R, Quantmod, TTR

March 12, 2010 | 0 Comments

I've been toying around with the examples given on the FOSS trading site for some of the great work they've put together in the Quantmod and TTR packages. Those viewers who are looking for a nice (and free) backtesting suite to possibly complement s...