Displaying 20 results from an estimated 2000 matches similar to: "PCA in R"
2009 Feb 13
4
PCA functions
Hi All, would appreciate an answer on this if you have a moment;
Is there a function (before I try and write it !) that allows the input of a
covariance or correlation matrix to calculate PCA, rather than the actual
data as in princomp()
Regards
Glenn
[[alternative HTML version deleted]]
2008 Sep 09
4
PCA and % variance explained
After doing a PCA using princomp, how do you view how much each component
contributes to variance in the dataset. I'm still quite new to the theory of
PCA - I have a little idea about eigenvectors and eigenvalues (these
determine the variance explained?). Are the eigenvalues related to loadings
in R?
Thanks,
Paul
--
View this message in context:
2005 Jul 08
2
extract prop. of. var in pca
Dear R-helpers,
Using the package Lattice, I performed a PCA.
For example
pca.summary <- summary(pc.cr <- princomp(USArrests, cor = TRUE))
The Output of "pca.summary" looks as follows:
Importance of components:
Comp.1 Comp.2 Comp.3 Comp.4
Standard deviation 1.5748783 0.9948694 0.5971291 0.41644938
Proportion of Variance 0.6200604
2008 Jul 03
2
PCA on image data
Dear R users,
i would like to apply a PCA on image data for data reduction.
The image data is available as three matrices for the
RGB values. At the moment i use
x <- data.frame(R,G,B)#convert image data to data frame
pca<-princomp(x,retx = TRUE)
This is working so far.
>From this results then i want to create a new matrix
from the first (second..) principal component. Here i stuck.
2010 Apr 02
2
Biplot for PCA using labdsv package
Hi everyone,
I am doing PCA with labdsv package. I was trying to create a biplot graphs
in order to observe arrows related to my variables. However when I run the
script for this graph, the console just keep saying:
*Error in nrow(y) : element 1 is empty;
the part of the args list of 'dim' being evaluated was:
(x)*
could please someone tell me what this means? what i am doing
2010 Jun 30
3
Factor Loadings in Vegan's PCA
Hi all,
I am using the vegan package to run a prcincipal components analysis
on forest structural variables (tree density, basal area, average
height, regeneration density) in R.
However, I could not find out how to extract factor loadings
(correlations of each variable with each pca axis), as is straightforwar
in princomp.
Do anyone know how to do that?
Moreover, do anyone knows
2010 Apr 16
1
PCA scores
Hi all,
I have a difficulty to calculate the PCA scores. The PCA scores I calculated
doesn't match with the scores generated by R,
mypca<-princomp(mymatrix, cor=T)
myscore<-as.matrix(mymatrix)%*%as.matrix(mypca$loadings)
Does anybody know how the mypca$scores were calculated? Is my formula not
correct?
Thanks a lot!
Phoebe
[[alternative HTML version deleted]]
2011 Jun 30
2
sdev value returned by princomp function (used for PCA)
Dear all,
I have a question about the 'sdev' value returned by the princomp function (which does principal components analysis).
On the help page for princomp it says 'sdev' is 'the standard deviations of the principal components'.
However, when I calculate the principal components for the USArrests data set, I don't find this to be the case:
Here is how I
2003 Apr 26
3
PCA
Hi, I have a dataset of dimensions 50 x 15000, and tried to use princomp or prcomp on this dataset with 15000 columns as variables, but it seems that the 2 functions can;t handle this large number of columns, anyone has nay suggestions to get around this? Thanks
---------------------------------
[[alternate HTML version deleted]]
2009 Jan 13
1
PCA loadings differ vastly!
hi, I have two questions:
#first (SPSS vs. R):
I just compared the output of different PCA routines in R (pca, prcomp,
princomp) with results from SPSS. the loadings of the variables differ
vastly! in SPSS the variables load constantly higher than in R.
I made sure that both progr. use the correlation matrix as basis. I
found the same problem with rotated values (varimax rotation and rtex=T
2008 Jul 01
2
PCA : Error in eigen(cv,
Hi all,
I am doing bootstrap on a distance matrix, in which samples have been
drawn with replacement. After that I do PCA on a resulted matrix, and
these 2 steps are repeated 1000 times.
pca(x) is a vector where I wanted to store all 1000 PCAs; and x is from
1 to 1000
SampleD is a new matrix after resampling;
I am getting the following error message, which I don't understand:
....
2011 Jun 06
2
adding an ellipse to a PCA plot
Hi,
I created a principal component plot using the first two principal
components. I used the function princomp() to calculate the scores.
now, I would like to superimpose an ellipse representing the center
and the 95% confidence interval of a series of points in my plot (as
to illustrate the grouping of my samples).
I looked at the ellipse() function in the ellipse package but can't
get it
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
version.
data(mtcars)
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of
2012 Apr 25
1
pca biplot.princomp has a bug?
x=rmvnorm(2000, rep(0, 6), diag(c(5, rep(1,5))))
x=scale(x, center=T, scale=F)
pc <- princomp(x)
biplot(pc)
There are a bunch of red arrows plotted, what do they mean? I knew that the
first arrow labelled with "Var1" should be pointing the most varying
direction of the data-set (if we think them as 2000 data points, each being
a vector of size 6). I also read from
2011 Mar 03
2
PCA - scores
I am running a PCA, but would like to rotate my data and limit the
number of factors that are analyzed. I can do this using the
"principal" command from the psych package [principal(my.data,
nfactors=3,rotate="varimax")], but the issue is that this does not
report scores for the Principal Components the way "princomp" does.
My question is:
Can you get an
2009 Oct 28
2
Labelling individual points on 3D PCA scatterplot
Hi There,
I'm attempting to plot 10 values on a three-dimensional PCA with text labels
next to each point. While i have no trouble doing this on 2D plots using the
'text' or 'textxy' function, I cannot find a function to do this on a 3D
plot.
I am using princomp for my PCA:
>PCA<-princomp(eucdata, cor=TRUE)
>PCA$scores [,1:3] # the three principal components i
2004 Nov 24
2
LDA with previous PCA for dimensionality reduction
Dear all, not really a R question but:
If I want to check for the classification accuracy of a LDA with
previous PCA for dimensionality reduction by means of the LOOCV method:
Is it ok to do the PCA on the WHOLE dataset ONCE and then run the LDA
with the CV option set to TRUE (runs LOOCV)
-- OR--
do I need
- to compute for each 'test-bag' (the n-1 observations) a PCA
2005 Mar 26
5
PCA - princomp can only be used with more units than variables
Hi all:
I am trying to do PCA on the following matrix.
N1 N2 A1 A2 B1 B2
gene_a 90 110 190 210 290 310
gene_b 190 210 390 410 590 610
gene_c 90 110 110 90 120 80
gene_d 200 100 400 90 600 200
>dataf<-read.table("matrix")
>
2012 Oct 19
1
factor score from PCA
Hi everyone,
I am trying to get the factor score for each individual case from a principal component analysis, as I understand, both princomp() and prcomp() can not produce this factor score, the principal() in psych package has this option: scores=T, but after running the code, I could not figure out how to show the factor score results. Here is my code, could anyone give me some advice please?
2007 Dec 18
1
PCA - "cov.wt(z) : 'x' must contain finite values only"
I am trying to run PCA on a matrix (the first column and row are
headers). There are several cells with NA's. When I run PCA with the
following code:
______________________________________
setwd("I:/PCA")
AsianProp<-read.csv("Matrix.csv", sep=",", header=T, row.names=1)
attach(AsianProp)
AsianProp
AsianProp.pca<-princomp(AsianProp, na.omit)