Dear Andrew,

I will try help you, but is interesting you hear from other colleagues to.
In fact, it is difficult you know the variable that is more important to
you. But, by other side, as PCA try to concentrate the must information
(variance) on the first axis (mainly PC1 & PC2), you can estimate how much
of the variance are "explained" for these axis. After you generate the
principal components, you can look at the correlation between the original
variables and the firts PCs. Those variables highly correlationed
(positively or negatively) could be assumed as being the must "important"
variables that contribute to these components. Below we have a example.


# RUN STEP 1 = simulating 4 variables
elevation  <-rnorm(100,mean=500, sd=200)
temperature<-elevation/30+runif(100,min=-5, max=+5)
noise1    <-runif(100,min=0, max=10)^2
noise2    <-runif(100,min=10, max=20)

# RUN STEP 2 = see the histogram of all variables
par(mfrow=c(2,2))
hist(elevation)
hist(temperature)
hist(noise1)
hist(noise2)

# RUN STEP 3 = see the scatterplot between all paired variables
df<-data.frame(cbind(elevation, temperature, noise1, noise2))
x11()
pairs(df)



# RUN STEP 4 = compute prcomp, plot the "Variances" and show the summary for
prcomp
df.prcomp<-prcomp(df)
x11()
plot(df.prcomp)

df.prcomp

#Rotation:   OBSERV that elevation and PC1 is 99% correlated (positively)
#  OBSERV that noise1 and PC2 is 99% correlated (negatively)
#  of course this results is just to show how interpret the results
#                   PC1         PC2          PC3         PC4
#elevation   0.99890373  0.03288915 -0.004947784  0.03294170
#temperature 0.03279254  0.01229805  0.235019805 -0.97135941
#noise1      0.03331621 -0.99927703 -0.011447629 -0.01429652
#noise2      0.00245202  0.01457635 -0.971910573 -0.23488583


# RUN STEP 5 = here you have the pct of standard deviation
#             (not variance) for each axis
pct.sdev<-df.prcomp$sdev/sum(df.prcomp$sdev)*100

pct.sdev


I hope this help,



Miltinho

Brazil

2008/6/17, Andrew Halford <andrew.halford@gmail.com>:
>
> Hi All,
>
> I am a new subscriber to this list and a very new convert to R. I am doing
> a
> PCA on a single dataset and want to control which variables are plotted as
> vectors on the biplot produced. How can I first determine which variables
> are most important in producing the ordination and how do I then control
> what variables are included as vectors in the biplot?
>
> cheers
>
> Andy
> --
> Andrew Halford
> Associate Researcher
> Marine Laboratory
> University of Guam
> Ph: +1 671 734 2948
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

	[[alternative HTML version deleted]]

