[R] Several PCA questions...

Dan Bolser dmb at mrc-dunn.cam.ac.uk
Tue Jun 29 15:51:14 CEST 2004

Thanks Jonathan and Brian for advise, all but for the last point I will
do more background reading. To come back to the last point...

>> Finally, I would like to make a contour plot of the above biplot, is this
>> possible? (or even a good way to present the data?

>Brian said:
>What do you propose to represent by the contours?  Biplots have a 
>well-defined interpretation in terms of distances and angles.
>Jonathan said:
>No idea how to do this or why you would want it.

Basically I would like to make a 2d smothed density, represented as a
countour plot. I would like to do this as a crude visual clustering of my 
data points.

i.e. instead of representing data by the row labels in the biplot, I would
like to see just a single dot for each data point. Then I would like to
only see the density of these points in 2d (hence contours).

For example...

x <- rnorm(1000)
y <- rnorm(1000)



z <- kde2d(x,y)


I imagine the above in the context of my biplot, and I would like to see
peaks which represent clusters of datapoints in 2d. However, I don't know
how to get x,y coords from the pc object or the biplot function.

Thanks again for the other tips, I need to read more! I will just
throw one final question out there (perhaps to further highlight my

I thought that a significant factor in my data was the relative magnitude
of the different variables, so I thought about making a new variable for
each distinct pair of existing variables, and setting that new (pariwise)
variable to 1 or 0 depending on the relative magnitude of the two
component variables. Then I do PCA (or some other clustering (or a simple
grouping)) on this new set of variables, and hey presto, I have the
classes of my data points. Just an idea. Any good?



More information about the R-help mailing list