# Visualizing highly dimensional data with response that can take only 3 values?

Examples of data

Consider these data (coded in R)

yValue = function(a,b,c,d)
{
r = runif(1,0.7,1)
l = (a>3) * b/20 + c/4 * (d<10) + d/11 - a/4
R = rep(0,length(a))
R[r > l] = 2
R[r < l] = 1
R[b > 6] = 0
return (R)
}

set.seed(1)
a=1:5;b=1:8;c=1:4;d=1:12;e=1:7
d = expand.grid(a=1:5,b=1:8,c=1:4,d=1:12,e=1:7)
d$y = as.factor(yValue(d$a,d$b,d$c,d\$d))


Goal

y is my response variable and it can take three different values.

I fail to think of a good way to visualize these data. I would like to visualize the space formed by the explanatory variables a,b,c,e,f and see which combinations is causing the the y variable to take one value or another.

The best I could find for the moment is something like

require(ggplot2)
ggplot(d,aes(x=a,y=b)) + geom_tile(aes(fill=y)) + facet_grid(d~c+e) • Are the variables a:e supposed to be continuous or categorical? Do you want to visualize these data to help yourself understand what's going on, or to present to others to make a point (& if so, what)? Nov 3 '16 at 17:26

For high dimensional data, nothing is going to be as great as 2-D data on a 2-D surface. However, a decent scalable approach is to use displays based parallel axes instead of perpendicular axes.

An array of histograms is one version of this. The utility in seeing relationships comes from linked selection, so that if you, say, select the y=1 bin, you see the values of those rows in the other variables. You can apply that idea to arrays of other graphs as well, but there is one special kind of graph designed for parallel axes called parallel coordinates, or parallel sets when applied to categorical data which I have done in this view of your data. The areas are colored by the Y variable, so you can see a few Y-specific features, and you can sometimes see pairwise relationships between adjacent axes.

(I made these in JMP, but I believe there are a few options for parallel coordinates in R.)

I think this is on the right track. Using geom_tile or other methods to make a “heatmap” is an effective way to visualize this.

This has also been popularized as a “lasagna plot”. See this question for more help.

I think plots of this type are usually used with time as the x-axis, but I see no reason why you couldn’t use some other variable instead.

EDIT: I posted this before your edit to the panel plot. I'd have to consider more carefully if a panel of heatmaps is useful or not