For the original use which I later found out would be fantasy football rankings, I thought this quartile plot would work nicely. I went to work making changes to the quartile plot so that it would play well with rCharts and also allow small multiples or facets.

It looked so close that I just had to try to replicate it. I scrambled to scrape the surface of Three Level Mixed Effects Logistic Regression just enough to extricate the data needed for the plot. I dug into the str of the lattice plot and examined the source code from lme4.

This little bit of code gets the data that we will need to plot.

## back into the x, y, and errorbar components by looking at
## both the structure of the dotplot and also the lme4 source
## https://github.com/lme4/lme4/blob/bf060a61168499d314b6248da8b2dc468e3af3c9/R/lmer.R#L2190
# str(dP)
## dP$DID$panel.args.common gives us the dotplot se which will be our error portion
## looking at the source from lme4 we get by using attr
## attr(ranef(m3a, which = "DID", postVar = TRUE)$DID,"postVar")
## dP$DID$panel.args$x or sort(ranef(m3a, which = "DID", postVar = TRUE)$DID[,1]) will be our y
## dP$DID$panel.args$y or just the index will serve as our x
## now that we know our x, y, and errorbar
## make a data.frame that we will use with rCharts
r <- ranef(m3a, which = "DID", postVar = TRUE)$DID
dfForPlot <- data.frame(
rownames(r), #this will be our x
r[,1], #this will be our y
as.numeric(attr( r, "postVar" )) #this will be our se
)
colnames(dfForPlot) <- c("id","intercept","se")

d3-ify in R with rCharts

I never thought I would say this, but the d3/rCharts piece is actually the easiest. Just specify a couple of parameters, and we have an interactive error bar plot.

And since we are spoiled in R by facets in ggplot2 and strips in lattice, I just have to demo the small multiples capability of rCharts after a little bit of tweaking of the js code. I hope the facet = list(x = "variable") is simple enough, but soon I think rCharts will have a facet command to make it even easier.