Articles by Matt Asher

Random samples in JS using R functions

October 15, 2015 | Matt Asher

For a JavaScript-based project I’m working on, I need to be able to sample from a variety of probability distributions. There are ways to call R from JavaScript, but they depend on the server running R. I can’t depend on that. I need a pure JS solution. I ... [Read more...]

Labor day distribution fun

September 1, 2014 | Matt Asher

Pinned, entropy augmented, digitally normal distribution, of no particular work-related use and thus perfectly suitable for today. Code in R: iters = 1000 sd = 2 precision = 20   results = rep(0,iters)   for(i in 1:iters) { x = floor(rnorm(20,5,sd) %% 10) results[i] = paste(c('.',x),sep="",collapse="") }   results = as.numeric(results)   plot(density(results,... [Read more...]

The hat trick

July 3, 2013 | Matt Asher

In his book Quantum Computing Since Democritus, Scott Aaronson poses the following question: Suppose that you’re at a party where every guest is given a hat as they walk in. Each hat has either a pineapple or a watermelon on top, picked at random with equal probability. The guests ... [Read more...]

Uncovering the Unreliable Friend Distribution

May 30, 2013 | Matt Asher

Head down to your local hardware store and pick up a smoke detector. Pop off the cover and look inside. You’ll see a label that mentions Americium 241, a radioactive isotope. Put on your HEV suit, grab a pair of tweezers and a fine-tipped pen, and remove the 0.3 millionths of ... [Read more...]

High Obesity levels found among fat-tailed distributions

April 11, 2013 | Matt Asher

In my never ending quest to find the perfect measure of tail fatness, I ran across this recent paper by Cooke, Nieboer, and Misiewicz. They created a measure called the “Obesity index.” Here’s how it works: Step 1: Sample four times from a distribution. The sample points should be independent ... [Read more...]

Review of Mathematica 9 and R-link

March 18, 2013 | Matt Asher

VIDEO TRANSCRIPT: Hello, this is Matt Asher from I’m going to be reviewing Mathematica 9, from Wolfram Research. In particular, I’ll be focusing on using it with R and to do Monte Carlo simulations and other statistical work. You can find a full transcript of this video ... [Read more...]

Population simulation leads to Valentine’s Day a[R]t

February 14, 2013 | Matt Asher

Working on a quick-and-dirty simulation of people wandering around until they find neighbors, then settling down. After playing with the coloring a bit I arrived at the above image, which I quite like. Code below: # Code by Matt Asher for # Feel free to modify and redistribute, but please ... [Read more...]

Fake text generation the wrong way, and a contest

January 23, 2013 | Matt Asher

As part of a bigger project, I needed to simulate a text string based on a source document, but at the character level. Just in case people find the code useful, I’ve uploaded it to MCMCtext.r. In my simulated text, each character is chosen based on the transition ... [Read more...]

Let it snow!

December 14, 2012 | Matt Asher

A couple days ago I noticed a fun piece of R code by Allan Roberts, which lets you create a digital snowflake by cutting out virtual triangles. Go give it a try. Roberts inspired me to create a whole night sky of snowflakes. I tried to make the snowfall look ... [Read more...]

The surprisingly weak case for global warming

December 3, 2012 | Matt Asher

I welcome your thoughts on this post, but please read through to the end before commenting. Also, you’ll find the related code (in R) at the end. For those new to this blog, you may be taken aback (though hopefully not bored or shocked!) by how I expose my ... [Read more...]

How fat are your tails?

October 25, 2012 | Matt Asher

Lately I’ve been thinking about how to measure the fatness of the tails of a distribution. After some searching, I came across the Pareto Tail Index method. This seems to be used mostly in economics. It works by finding the decay rate of the tail. It’s complicated, both ... [Read more...]

The unicorn problem

October 13, 2012 | Matt Asher

Let’s say your goal is to observe all known species in a particular biological category. Once a week you go out and collect specimens to identify, or maybe you just bring your binoculars to do some spotting. How long will it take you to cross off every species on ... [Read more...]

Wasting away again in Martingaleville

December 1, 2011 | Matt Asher

Alright, I better start with an apology for the title of this post. I know, it’s really bad. But let’s get on to the good stuff, or, perhaps more accurately, the really frightening stuff. The plot shown at the top of this post is a simulation of the ... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)