# Articles by Matt Asher

### Random samples in JS using R functions

October 15, 2015 |

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...]

### Can pregnant women intuit the sex of their children?

December 11, 2014 |

“So let’s start with the fact that the study had only 100 people, which isn’t nearly enough to be able to make any determinations like this. That’s very small power. Secondly, it was already split into two groups, and the two groups by the way have absolutely zero ... [Read more...]

### Labor day distribution fun

September 1, 2014 |

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 |

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 |

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 |

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 |

VIDEO TRANSCRIPT: Hello, this is Matt Asher from StatisticsBlog.com. 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...]

### Statistical computation in JavaScript — am I nuts?

February 28, 2013 |

Over the past couple weeks, I’ve been considering alternatives to R. I’d heard Python was much faster, so I translated a piece of R code with several nested loops into Python (it ran an order of magnitude faster). To find out more about Mathematica 9, I had an extended ... [Read more...]

### What’s my daughter listening to? HTML chart gen in R

February 22, 2013 |

My daughter, who turns 10 in April, has discovered pop music. She’s been listing to Virgin Radio 99.9, one of our local stations. Virgin provides an online playlist that goes back four days, so I scraped the data and brought it into R. The chart shown at top shows all of ... [Read more...]

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

February 14, 2013 |

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 statisticsblog.com # Feel free to modify and redistribute, but please ... [Read more...]

### Landmine detection revisited; the inverse unicorn problem

February 4, 2013 |

A couple weeks ago I wrote about an interesting idea to clear landmines using the power of the wind. A reader asked me to comment more on the value of using these wind-powered “Kafons” to do an initial assay of a suspected minefield, an idea I mentioned at the end ... [Read more...]

### Fake text generation the wrong way, and a contest

January 23, 2013 |

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...]

### Simulation of landmine clearing with Massoud Hassani’s Mine Kafon

January 10, 2013 |

Code used: MineClearingSimulationWithKafons.r TRANSCRIPT OF VIDEO: Hello, I’m Matt Asher with StatisticsBlog.com. This video is about my attempt to simulate a landmine clearing device built by Massoud Hassani called the Mine Kafon. I’ve put a link to his webpage at StatisticsBlog.com, I highly recommend checking ... [Read more...]

### Let it snow!

December 14, 2012 |

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 |

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 |

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 |

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...]

### Iowa: Was the fix in? (a statistical analysis of the results)

January 4, 2012 |

Summary/TL;DR Either the first precincts to report were widely unrepresentative of Iowa as a whole, or something screwy happened. Background Yesterday was the first primary for the 2012 U.S. presidential elections. When I logged off the internet last night, the results in Iowa showed a dead heat between ... [Read more...]

### My oh my

December 6, 2011 |

Noted without comment, visit Biostatistics Ryan Gosling !!! for more gems like the one above. [Read more...]

### Wasting away again in Martingaleville

December 1, 2011 |

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