Publications by andrew

Bags, Balls and the Hypergeometric Distribution: Update

02.04.2015

So… the Hypergeometric distribution (as used in one of my previous posts). That was a bit of overkill, wasn’t it? To recap the problem: we have an urn filled with a selection of white and black balls. We want to calculate the probability that all of the white balls and all but one of the black balls are removed from the urn. Obviously I was j...

1319 sym R (42 sym/1 pcs)

Bags, Balls and the Hypergeometric Distribution

03.04.2015

A friend came to me with a question. The original question was a little complicated, but in essence it could be explained in terms of the familiar urn problem. So, here’s the problem: you have an urn with 50 white balls and 9 black balls. The black balls are individually numbered. Balls are drawn from the urn without replacement. What is the pr...

2961 sym R (877 sym/7 pcs) 2 img

A Sankey Plot with Uniform Coloured Edges

07.04.2015

Following up on my previous post about generating Sankey plots with the riverplot package. It’s also possible to generate plots which have constant coloured edges. Here’s how (using some of the data structures from the previous post too): edges$col = sample(palette, size = nrow(edges), replace = TRUE) edges$edgecol <- "col" river <- makeRive...

734 sym R (159 sym/1 pcs) 2 img

Comrades Marathon Finish Predictions

23.04.2015

* If you see a bunch of [Math Processing Error] errors, you might want to try opening the page in a different browser. I have had some trouble with MathJax and Windows Explorer. There are various approaches to predicting Comrades Marathon finishing times. Lindsey Parry, for example, suggests that you use two and a half times your recent marathon ...

6658 sym R (1690 sym/4 pcs) 32 img

Recent Common Ancestors: Simple Model

15.05.2015

An interesting paper (Modelling the recent common ancestry of all living humans, Nature, 431, 562–566, 2004) by Rohde, Olson and Chang concludes with the words: Further work is needed to determine the effect of this common ancestry on patterns of genetic variation in structured populations. But to the extent that ancestry is considered in gene...

8738 sym R (3195 sym/8 pcs) 28 img

R Recipe: Reordering Columns in a Flexible Way

16.05.2015

Suppose you have a data frame with a number of columns. > names(trading) [1] "OpenDate" "CloseDate" "Symbol" "Action" "Lots" "SL" "TP" "OpenPrice" [9] "ClosePrice" "Commission" "Swap" "Pips" "Profit" "Gain" "Duration" "Trader" [17] "System" You want to put the Trader and System colu...

840 sym R (897 sym/3 pcs)

Short course on Bayesian data analysis and Stan 19-21 July in NYC!

07.07.2015

Bob Carpenter, Daniel Lee, and I are giving a 3-day short course in two weeks. Before class everyone should install R, RStudio and RStan on their computers. If problems occur please join the stan-users group and post any questions. It’s important that all participants get Stan running and bring their laptops to the course. Class structure and...

2658 sym 2 img

R sucks

23.12.2015

I’m doing an analysis and one of the objects I’m working on is a multidimensional array called “attitude.” I took a quick look: > dim(attitude) [1] 30 7 Huh? It’s not supposed to be 30 x 7. Whassup? I search through my scripts for a “attitude” but all I find is the three-dimensional array. Where did this 2-way array come from...

2203 sym R (4201 sym/6 pcs)

rstanarm and more!

14.01.2016

Ben Goodrich writes: The rstanarm R package, which has been mentioned several times on stan-users, is now available in binary form on CRAN mirrors (unless you are using an old version of R and / or an old version of OSX). It is an R package that comes with a few precompiled Stan models — which are called by R wrapper functions that have the sam...

6801 sym R (608 sym/1 pcs) 2 img

Short course on Bayesian data analysis and Stan 18-20 July in NYC!

28.06.2016

Jonah Gabry, Vince Dorie, and I are giving a 3-day short course in two weeks. Before class everyone should install R, RStudio and RStan on their computers. (If you already have these, please update to the latest version of R and the latest version of Stan, which is 2.10.) If problems occur please join the stan-users group and post any questions...

3116 sym 2 img