# Statistically group chemical batches

I have 80 chemical batches, each of which has 8 associated measurements like pH, viscosity, etc. Is there a way to use Principal Components Analysis or Factor Analysis to group the similar batches together? I know I can use cluster analysis, but I want to have a different visual representation of batch groups other than the dendogram. I'd like to have a bi-plot. I tried to perform a PCA, but got an error message that there cannot be more variables than observations. My matrix has the 80 batches as the column names, and the 8 measurements as the row names. When this matrix is transposed, PCA just groups the like measurements, not the batches.

-
Which software are you working with? –  Matt Parker Feb 1 '11 at 0:36
transpose your data. You sample 8 measurements and the each batch is an element in your sample. In this case PCA expects batches in rows and measurements in the columns. –  mpiktas Feb 1 '11 at 8:27

• As already stated (by @mpiktas), in order to do PCA, you need to transpose your data so that chemical batches are rows and "measurements" are columns. You can then run a PCA on the data and plot the 80 chemical batches on axes derived from the first two components. Here's an example on Quick-R of doing this in R.

• Also a small supplementary suggestion, you might want to have a look at Chernoff faces. They present a face where each of your eight variables would represent a feature on the face. The size or shape of the feature indicates something about the variable. Flowing data has a tutorial in R with images.

-

You'll be hard-pressed to show an 8-D representation of sets of similar batches using anything but a dreary table. But, along the lines of Bill's point I think, if you're willing to select the 3 most interesting or most discriminating dimensions, you could show where each batch falls within a cube defined by those 3. Perhaps better is to first do a cluster analysis and then show where each cluster falls within such a cube. Some software (such as SPSS) will allow you to assign each batch a color or a symbol according to its cluster, and you could draw spikes from each point to its cluster's centroid to create a nice, vivid effect.

-

You need to be more specific about what you mean by "similar", and provide some type of example. Maybe the following will help as an example of 8 batches with 3 measurements. Feel free to change it if you think it will help.

texinp <- "
Batch M1 M2 M3
1  0.01  14  -123
2  0.03  23    30
3  0.02  12    23
4  0.01  18  -107
5  0.04  49   110
6  0.01   8  -101
7  0.02  11    11
8  0.01  14  -115"

#Read the data into a data frame
df

#Plot some stuff
plot(df$M1, df$M2)
plot(df$M2, df$M3)
plot(df$M1, df$M3)


If you're not using R, show the example in whatever you're using.

-