[R] plotting prcomp
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Jun 27 18:05:25 CEST 2008
On Fri, 27 Jun 2008, Prof Brian Ripley wrote:
> On Fri, 27 Jun 2008, Dan Bolser wrote:
>
>> Please consider the following PCA example;
>>
>> my.df <-
>> data.frame(A=(x <- rnorm(100,mean=100, sd=10)),
>> B=(y <- x + rnorm(100,mean=10, sd=10)))
>>
>> plot(my.df)
>>
>> my.pc <-
>> prcomp(my.df, center=TRUE, scale=TRUE)
>>
>> biplot(my.pc)
>>
>> my.x <- (my.pc$x)[,1]
>> my.y <- (my.pc$x)[,2]
>>
>> plot(my.x, my.y, type="n")
>> text(my.x, my.y, labels=1:100)
>>
>> Clearly the plots have the same relative values, but I can't work out how
>> the second plot is relative to the first. I have been reading the manual,
>> but I still can't work it out.
>>
>> Can anyone show me the code to generate the data that I see plotted using
>> biplot?
I forgot to answer that: just ask R to show you stats:::biplot.prcomp
>> What am I missing?
>
> Reading the references on ?biplot.prcomp, or a good book on the subject (such
> as MASS or Gower & Hand).
>
> A biplot is a specific type of plot and the help page does not spell out the
> rather mathematical details (and there are several variants).
>
>>
>> Dan.
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list