Blog Archives

S&P 500 Returns

September 1, 2011
By
S&P 500 Returns

I'll begin with a familiar image:That plot shows the closing values of the S&P 500 index from 1990 until today. It's a useful representation -- at a glance, you can tell when the market rose and fell. That said, it does have some problems: we're...

Read more »

A Bayesian Guessing Game

August 3, 2011
By
A Bayesian Guessing Game

You, the player, must think of some set, eg "odd numbers" or "perfect squares," and that'll be your little secret. Now think of some numbers that live in the intersection of your set and the integers {1, 2, ... , 100} -- for example, if you've chosen ...

Read more »

A Currency Graph

July 27, 2011
By
A Currency Graph

Here's a graph in which nodes (and edges) represent currencies (and exchange rates):library(igraph)currencies <- factor(c("EUR", "USD", "JPY", "GBP"))df <- subset(expand.grid(from=currencies, to=currencies), from != to)GetExchangeRate...

Read more »

A Plot of 250 Random Walks

July 22, 2011
By
A Plot of 250 Random Walks

For some reason I feel like plotting some random walks. Nothing groundbreaking, but hopefully this post will be useful to someone. Here's my R code:# Generate k random walks across time {0, 1, ... , T}T <- 100k <- 250initial.value <- 10GetRa...

Read more »

Men with Hats

July 6, 2011
By
Men with Hats

Suppose N people (and their hats) attend a party (in the 1950s). For fun, the guests mix their hats in a pile at the center of the room, and each person picks a hat uniformly at random. What is the probability that nobody ends up with their own hat?E...

Read more »

Kernel Density Estimates & Truncated Normals

June 24, 2011
By
Kernel Density Estimates & Truncated Normals

Earlier today I read a post about truncated normals, and one plot in particular jumped out at me:By definition, the truncated normal should have zero density everywhere to the left of the truncation point, but that's not what we see in the plot. What'...

Read more »

A Little Sampling Puzzle

June 18, 2011
By
A Little Sampling Puzzle

Suppose you have 10 objects from which you take a sample of size 20 (with replacement, or you're in trouble). What's the probability that each object was chosen at least once? Getting an answer via simulation is pleasantly easy:f <- function(n=10,...

Read more »

Dependence and Correlation

June 13, 2011
By
Dependence and Correlation

In everyday life I hear the word "correlation" thrown around far more often than "dependence." What's the difference? Correlation, in its most common form, is a measure of linear dependence; the catch is that not all dependencies are linear. The set...

Read more »

On Crows

June 12, 2011
By
On Crows

Today I made the mistake of clicking on the "Next Blog" button, which took me to a rather inane post complaining that crows are (obviously) stupid (because they are sometimes hit by cars). I was reminded that crows are actually quite smart.

Read more »

A Little R Counter

June 11, 2011
By
A Little R Counter

I recently read a great post about environments in R, which featured this little bit of code:> createCounter <- function(value) { function(i) { value <<- value+i} }> counter <- createCounter(0)> counter(1)> a <- counter(0)&gt...

Read more »

Sponsors

Mango solutions



plotly webpage

dominolab webpage



Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training

datasociety

http://www.eoda.de





ODSC

ODSC

CRC R books series





Six Sigma Online Training









Contact us if you wish to help support R-bloggers, and place your banner here.

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)