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.
-
$\begingroup$ Which software are you working with? $\endgroup$– Matt ParkerCommented Feb 1, 2011 at 0:36
-
2$\begingroup$ 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. $\endgroup$– mpiktasCommented Feb 1, 2011 at 8:27
4 Answers
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.
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 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 <- read.table(textConnection(texinp), header=TRUE)
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.
I'm not pretty sure, but i think that if you more variable than observation the Partial Least Square (PLS) regression is the right tool for you, and it's commonly used by chemometrician.
As you know this site is R biased and i use R too, so i'll recommend to take a look at pls package package which can also do principal component regression, and it also have a biplot.mvr (S3 method for biplot) function to make a biplot.
A good starting point can be http://mevik.net/work/software/pls.html , is the website of package's author and have some useful link like the journal of statistical software article about the R package pls.