Displaying 20 results from an estimated 5000 matches similar to: "simple (NEWBIE) question re: prcomp or princomp"
2006 Mar 25
1
Suggest patch for princomp.formula and prcomp.formula
Dear all,
perhaps I am using princomp.formula and prcomp.formula in a way that
is not documented to work, but then the documentation just says:
formula: a formula with no response variable.
Thus, to avoid a lot of typing, it would be nice if one could use '.'
and '-' in the formula, e.g.
> library(DAAG)
> res <- prcomp(~ . - case - site - Pop - sex, possum)
2012 Aug 23
1
Accessing the (first or more) principal component with princomp or prcomp
Hi ,
To my knowledge, there're two functions that can do principal component
analysis, princomp and prcomp.
I don't really know the difference; the only thing I know is that when
the sample size < number of variable, only prcomp will work. Could someone
tell me the difference or where I can find easy-to-read reference?
To access the first PC using princomp:
2009 Oct 19
2
What is the difference between prcomp and princomp?
Some webpage has described prcomp and princomp, but I am still not
quite sure what the major difference between them is. Can they be used
interchangeably?
In help, it says
'princomp' only handles so-called R-mode PCA, that is feature
extraction of variables. If a data matrix is supplied (possibly
via a formula) it is required that there are at least as many
units as
2009 Nov 25
1
which to trust...princomp() or prcomp() or neither?
According to R help:
princomp() uses eigenvalues of covariance data.
prcomp() uses the SVD method.
yet when I run the (eg., USArrests) data example and compare with my own
"hand-written" versions of PCA I get what looks like the opposite.
Example:
comparing the variances I see:
Using prcomp(USArrests)
-------------------------------------
Standard deviations:
[1] 83.732400 14.212402
2008 Feb 10
1
prcomp vs. princomp vs fast.prcomp
Hi R People:
When performing PCA, should I use prcomp, princomp or fast.prcomp, please?
thanks.
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
2004 Nov 03
2
Princomp(), prcomp() and loadings()
In comparing the results of princomp and prcomp I find:
1. The reported standard deviations are similar but about 1% from
each other, which seems well above round-off error.
2. princomp returns what I understand are variances and cumulative
variances accounted for by each principal component which are
all equal. "SS loadings" is always 1.
3. Same happens
2006 Jun 26
1
princomp and prcomp confusion
When I look through archives at
https://stat.ethz.ch/pipermail/r-help/2003-October/040525.html
I see this:
Liaw, Andy wrote:
>In the `Detail' section of ?princomp:
>
>princomp only handles so-called Q-mode PCA, that is feature extraction of
>variables. If a data matrix is supplied (possibly via a formula) it is
>required that there are at least as many units as variables. For
2008 Nov 03
1
Input correlation matrix directly to princomp, prcomp
Hello fellow Rers,
I have a no-doubt simple question which is turning into a headache so
would be grateful for any help.
I want to do a principal components analysis directly on a correlation
matrix object rather than inputting the raw data (and specifying cor =
TRUE or the like). The reason behind this is I need to use polychoric
correlation coefficients calculated with John Fox's
2010 Nov 10
2
prcomp function
Hello,
I have a short question about the prcomp function. First I cite the
associated help page (help(prcomp)):
"Value:
...
SDEV the standard deviations of the principal components (i.e., the square
roots of the eigenvalues of the covariance/correlation matrix, though the
calculation is actually done with the singular values of the data matrix).
ROTATION the matrix of variable loadings
2000 Oct 03
3
prcomp compared to SPAD
Hi !
I've used the example given in the documentation for the prcomp function
both in R and SPAD to compare the results obtained.
Surprisingly, I do not obtain the same results for the coordinates of
the principal composantes with these two softwares.
using USArrests data I obtain with R :
> summary(prcomp(USArrests))
Importance of components:
PC1 PC2
2009 Mar 08
2
prcomp(X,center=F) ??
I do not understand, from a PCA point of view, the option center=F
of prcomp()
According to the help page, the calculation in prcomp() "is done by a
singular value decomposition of the (centered and possibly scaled) data
matrix, not by using eigen on the covariance matrix" (as it's done by
princomp()) .
"This is generally the preferred method for numerical accuracy"
1998 Aug 26
0
prcomp & princomp - revised
My previous post about prcomp and princomp was done in some haste as I had long
ago indicated to Kurt that I would try to have this ready for the June release,
and it appeared that I would miss yet another release. I also need to get it out
before it becomes hopelessly buried by other work.
Brian Ripley kindly pointed out some errors, and also pointed out that I was
suggesting replacing some
2003 Oct 16
1
princomp with more coloumns than rows: why not?
As of R 1.7.0, princomp no longer accept matrices with more coloumns
than rows. I'm curious: Why was this decision made?
I work a lot with data where more coloumns than rows is more of a rule
than an exception (for instance spectroscopic data). To me, princomp
have two advantages above prcomp: 1) It has a predict method, and 2)
it has a biplot method.
A biplot method shouldn't be too
2000 Apr 26
1
Factor Rotation
How does one rotate the loadings from a principal component analysis?
Help on function prcomp() from package mva mentions rotation:
Arguments
retx a logical value indicating whether the rotated
variables should be returned.
Values
rotation the matrix of variable loadings (i.e., a matrix
whose olumns contain the eigenvectors). The
function princomp returns this in the element
2006 Jun 16
2
bug in prcomp (PR#8994)
The following seems to be an bug in prcomp():
> test <- ts( matrix( c(NA, 2:5, NA, 7:10), 5, 2))
> test
Time Series:
Start = 1
End = 5
Frequency = 1
Series 1 Series 2
1 NA NA
2 2 7
3 3 8
4 4 9
5 5 10
> prcomp(test, scale.=TRUE, na.action=na.omit)
Erro en svd(x, nu = 0) : infinite or missing values in 'x'
2012 May 23
1
prcomp with previously scaled data: predict with 'newdata' wrong
Hello folks,
it may be regarded as a user error to scale() your data prior to prcomp() instead of using its 'scale.' argument. However, it is a user thing that may happen and sounds a legitimate thing to do, but in that case predict() with 'newdata' can give wrong results:
x <- scale(USArrests)
sol <- prcomp(x)
all.equal(predict(sol), predict(sol, newdata=x))
## [1]
2009 Mar 10
1
Using napredict in prcomp
Hello all,
I wish to compute site scores using PCA (prcomp) on a matrix with
missing values, for example:
Drain Slope OrgL
a 4 1 NA
b 2.5 39 6
c 6 8 45
d 3 9 12
e 3 16 4
...
Where a,b... are sites.
The command
> pca<-prcomp(~ Drain + Slope + OrgL, data = t, center = TRUE, scale =
TRUE, na.action=na.exclude)
works great, and from
2011 Nov 04
1
How to use 'prcomp' with CLUSPLOT?
Hello,
I have a large data set that has more columns than rows (sample data below). I am trying to perform a partitioning cluster analysis and then plot that using pca. I have tried using CLUSPLOT(), but that only allows for 'princomp' where I need 'prcomp' as I do not want to reduce my columns. Is there a way to edit the CLUSPLOT() code to use 'prcomp', please?
#
2005 Aug 03
3
prcomp eigenvalues
Hello,
Can you get eigenvalues in addition to eigevectors using prcomp? If so how?
I am unable to use princomp due to small sample sizes.
Thank you in advance for your help!
Rebecca Young
--
Rebecca Young
Graduate Student
Ecology & Evolutionary Biology, Badyaev Lab
University of Arizona
1041 E Lowell
Tucson, AZ 85721-0088
Office: 425BSW
rlyoung at email.arizona.edu
(520) 621-4005
1998 Apr 24
1
Warning: ignored non function "scale"
I've been working on a revised version of prcomp and princomp. Below is my
current draft of prcomp, which is marginally different from V&R. I've added
center and scale as optional arguments. However, scale causes the following:
> zi _ prcomp(iris[,,2])
Warning: ignored non function "scale"
because scale is both a variable and a function. Is there any way to avoid this