Skip to content


R packages

In class today we covered R packages. A quick try to create a package in Windows revealed that the Windows version of R does not come with the necessary build tools. I tried again on a Mac and ran into problems where package.skeleton failed to create the package directories since .find.package couldn’t find my newly created package. After a little playing around I found that package names cannot have an ‘_’ (at least on a Mac).

The R CMD CHECK command is very nice. It expands on the idea of static code checking to also check documentation, the install process, example code, etc.

Posted in Uncategorized.


Exploratory Model Analysis

I’ve recently come across a few papers on Exploratory Model Analysis. I wasn’t familiar with this work when writing the EnsembleMatrix paper, but they are very closely related. I was working with a ML researcher while designing the EnsembleMatrix visual interface and so did quite of bit of looking around in the ML literature. EMA is emerging in statistics and so didn’t appear in my search.

Here are a few pointers:
Parallel coordinates for exploratory modelling analysis (Antony Unwin)
Exploratory modelling analysis: visualizing the value of variables (Antony Unwin)
Meifly: Models explored interactively (Hadley Wickham)

I tried installing meifly, but it appears to depend on ggplot which is no longer available since ggplot2 has been released.

[2004] Exploratory data analysis for complex models (with discussion) (Andrew Gelman)
Discussion of this paper by Andreas Buja (Andreas Buja)
Rejoinder to discussion (Andrew Gelman)

This discussion is quite inspiring. The idea that visualizations can be thought of a statistical tests was quite eye opening. I think that this suggests quite a few directions for research in InfoVis. However, there hasn’t been much work in this area in the 4 years since the paper came out. Why? Perhaps the artificial division between InfoVis and statistical visualization has kept it from being noticed. Perhaps it’s just very hard

Posted in Uncategorized.


Visualizing Obama’s voter contact operation

Mark Blumenthal writes about new voter turnout information from the 2008 election. The following graph shows the level of voter contact from the Kerry and Obama campaigns (red=low to green=high). Obama had a broader voter contact operation spreading resources more effectively across those with a high probability of voting and voting Democrat.

20080116-catlistheatmap-thumb-550x411

Suggestions:

  • swap the direction of the vertical axis to put high turnout on top
  • add scale numbers, how many contacts? how high is high turnout?
  • since the number of contacts is nonnegative, I would use a sequential (one-sided) color scale (running from white, 0, to green) rather than a diverging scale.
  • how many people fall into each bucket? An additional grayscale plot showing the distribution of people would be helpful. Or preferably, if possible, the axes could be transformed to make the distribution of individuals roughly uniform across the plot.

Posted in visualization.


First time designing a visualization

The CHANCE contest submission below was my first time creating a complete static visualization that tries to tell a story. It’s sort of sad that I’m in my third year as a Ph.D. student studying visualization and I hadn’t done that yet.

I found it quite satisfying. Back in the olden days when I worked in rendering there was an immense amount of satisfaction that came from getting a rendering right–both visually and algorithmically. In visualization I hadn’t felt that yet, since all of my projects so far have been rather flaky research prototypes.

Over at FlowingData, Nathan is running a biweekly visualization competition/discussion. The first installment uses US poverty statistics. This’ll be a good chance for me to get more design experience.

Posted in visualization.


My submission to the CHANCE contest

antibiotics_justintalbot

Contest description is here:
http://www.public.iastate.edu/~larsen/graphics%20contest.pdf

Posted in visualization.


R complaints

I’ve recently read a number of complaints about the R programming language and thought I’d pull together the complaints into one place.

  • Inconsistent return types, list/vector confusion (Andrew Gelman)
    I always get mixed up about when to use [] and [[]].
  • Lack of useful types (Andrew Gelman)
    HavingĀ  nonnegative or [0,1) constrained floating point types would be quite useful in many circumstances. I haven’t used factors enough to know if they would work in most scenarios where an enumerated type is used in other languages. Having built in random variable types would be useful too.
  • Scalability and S4 complexity issues, mixed with R coding style issues (Andrew Gelman)
    I haven’t used S4, so I can’t comment on that. However, I have found it very useful to be able to type the name of a function on the command line and see it’s code directly. Unfortunately, built-in functions (e.g. lapply) don’t print out (probably because they really only exist in C code). It would be nice for such functions to print out an equivalent R implementation with a note saying that it really executes in C.
  • Vector indexing issues #1, #2, #2a, #3 (Radford Neal)
    As a CS guy I find 1-based vectors hard to justify, but Radford notes a number of other issues. I’ve been bitten by the automatic dimension dropping “feature” rather frequently.

Posted in Uncategorized.


Non-functional elements in R

This list is from John’s lecture:

  1. Operators and functions with side effects: (<<-, assign(), options(foo=))
  2. Nonstandard R objects: environments, connections.
  3. Random number generation
  4. Special mechanisms-”closures”

According to the R language definition, environments are mutable objects, so changes are visible outside of the function. R closures can have side effects due to the fact that when an R function returns a list of closures, these closures share the same environment. Since the environment is mutable, using <<- in the any of the closures will affect the other closures as well.

Example (inspired by a more involved example in John’s Software for Data Analysis):

> Counter <- function(start) {
+ t <- start
+ list(
+ inc = function() {t <<- t+1; t},
+ dec = function() {t <<- t-1; t} )
+ }
>
> counter <- Counter(5)
> counter[["dec"]]()
[1] 4
> counter[["dec"]]()
[1] 3
> counter[["inc"]]()
[1] 4

The Counter function returns a list of two functions “inc” and “dec”. Both functions are associated with the same environment. Thus successive calls to “inc” and “dec” operate on the same t variable. This use of closures has become largely out of date with the addition of S4 objects to the language.

Posted in Uncategorized.

Tagged with .


Data Analysis and Regression (Chapter 1)

In trying to develop a visual statistical system, it is frustrating to deal with the many limitations of common statistical tests–normality, equal variance, or equal sample size conditions. These conditions make the tests brittle; that is, they only work on a subset of all interesting data sets, and which subset is difficult to determine. How should this brittleness be accounted for in a statistical system? One possibility is to run additional tests and to warn the user if some condition is not met. In practice warnings would occur frequently and it would be up to the user’s judgment to decide if they were meaningful. To overcome this issue, a statistical system could be imagined that would attempt to mimic the decisions of an expert statistician. It would look at a battery of test results and automatically determine what additional tests could be run depending on what conditions were met. How would one train such a system? And, I think, more importantly, how would one evaluate the uncertainty or error in the results of such a complicated system?

I recently came across the idea of robust statistics, which originated with Tukey and associated statisticians in the middle of the last century. This concept appears here in the introductory chapter to Mosteller and Tukey’s Data Analysis and Regression. The goal is to find statistical tests that work on a broad range of data distributions. From a system implementation standpoint, this approach is much preferable to user input or a complicated expert system. However, I have not seen these techniques used in any of my Stats classes. Have they been superseded by Bayesian or bootstrapping approaches?

The other principle topic in this first chapter is “vague concepts”. The authors give the example of standard deviation, which is a very specific method for measuring the spread of a distribution. However, to evaluate our use of the standard deviation we must be able to place it in context of all other possible measures of spread. This meta-level or “vague concept” is lost in many introductions to statistics.

Posted in Uncategorized.


Intro to Computer Graphics courses

Pete Shirley has invited people to follow along with the assignments in his Intro to Graphics course covering the Reyes architecture.

Pat Hanrahan’s new intro course is covering an eclectic mix of topics. You can also check out his interesting use of a course Wiki.

At UNC, another former BYU student, Brandon Lloyd, is teaching a more typical intro course covering rasterization and raytracing.

And back at BYU, Robert Burton’s intro course is asking students to reimplement the OpenGL pipeline.

Posted in Uncategorized.


TreeMaps

I’ve been meaning to get back to TreeMaps for awhile. The recently unveiled Many-Eyes includes a TreeMap visualization. Martin Wattenberg (who did some research on TreeMap layouts) provides a typical example:



My main complaint with TreeMaps is their ugliness. Every TreeMap I have seen, including this one, look disorganized. Basically, we can only see the top level of the hierarchy, indicated with the strong dark lines and labeled. All other levels disappear into the patchwork mess. So one of the “strengths” of TreeMaps, the ability to directly view the hierarchy, is effectively neutered.

The layout also ignores good graphic design. Elements are not aligned and they do not visually cluster in meaningful ways. This is in contrast to indented lists, another common way to show hierarchical data, which use alignment and clustering very effectively to communicate the organization of the hierarchy.

More effective use of whitespace could dramatically improve the appearance of TreeMaps, but so few people use it well. Here‘s an example that does. Also notice how the alignment makes the diagram look very organized.

Next time: the travesty of Cushion TreeMaps.

Posted in visualization.