Displaying 20 results from an estimated 4000 matches similar to: "PCA error: svd(x, nu=0) infinite or missing values"
2008 Jan 18
2
plotting other axes for PCA
Hi R-community,
I am doing a PCA and I need plots for different combinations of axes (e.g.,
PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each
variables. What I need is exactly what I get using biplot (pca.object) but
for other axes.
I have plotted PC2 and 3 using the scores of the cases, but I don't get the
arrows proportional to the loadings of each variables on
2006 Jan 25
1
combining variables with PCA
hello R_team
having perfomed a PCA on my fitted model with the function:
data<- na.omit(dataset)
data.pca<-prcomp(data,scale =TRUE),
I´ve decided to aggregate two variables that are highly correlated.
My first question is:
How can I combine the two variables into one new predictor?
and secondly:
How can I predict with the newly created variable in a new dataset?
Guess I need the
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.
2011 Jul 29
1
Limited number of principal components in PCA
Hi all,
I am attempting to run PCA on a matrix (nrow=66, ncol=84) using 'prcomp'
(stats package). My data (referred to as 'Q' in the code below) are
separate river streamflow gaging stations (columns) and peak instantaneous
discharge (rows). I am attempting to use PCA to identify regions of that
vary together.
I am entering the following command:
2008 Feb 14
1
Principal component analysis PCA
Hi,
I am trying to run PCA on a set of data with dimension 115*300,000. The
columns represnt the snps and the row represent the individuals. so this is
what i did.
#load the data
code<-read.table("code.txt", sep='\t', header=F, nrows=300000)
# do PCA #
pr<-prcomp(code, retx=T, center=T)
I am getting the following error message
"Error: cannot allocate vector of
2008 Jun 11
3
Finding Coordinate of Max/Min Value in a Data Frame
Hi,
Suppose I have the following data frame.
__BEGIN__
> library(MASS)
> data(crabs)
> crab.pca <- prcomp(crabs[,4:8],retx=TRUE)
> crab.pca$rotation
PC1 PC2 PC3 PC4 PC5
FL 0.2889810 0.3232500 -0.5071698 0.7342907 0.1248816
RW 0.1972824 0.8647159 0.4141356 -0.1483092 -0.1408623
CL 0.5993986 -0.1982263 -0.1753299 -0.1435941 -0.7416656
CW
2004 Nov 14
2
Exporting to file: passing source name to file name in loop
Hi,
I'm having a mental block as to how I can automatically assign filenames
to the output of the following code. I am wishing to create a separate
.png file for every image created, each of them having a sequential
filename ie "sourcefile_index.png" so that I can create a movie from
them.
Please could someone tell me where I am going wrong?
the following code works fine and
2011 Dec 10
3
PCA on high dimentional data
Hi:
I have a large dataset mydata, of 1000 rows and 1000 columns. The rows
have gene names and columns have condition names (cond1, cond2, cond3,
etc).
mydata<- read.table(file="c:/file1.mtx", header=TRUE, sep="")
I applied PCA as follows:
data_after_pca<- prcomp(mydata, retx=TRUE, center=TRUE, scale.=TRUE);
Now i get 1000 PCs and i choose first three PCs and make a
2006 Feb 27
1
question about Principal Component Analysis in R?
Hi all,
I am wondering in R, suppose I did the principal component analysis on
training data set and obtain the rotation matrix, via:
> pca=prcomp(training_data, center=TRUE, scale=FALSE, retx=TRUE);
Then I want to rotate the test data set using the
> d1=scale(test_data, center=TRUE, scale=FALSE) %*% pca$rotation;
> d2=predict(pca, test_data, center=TRUE, scale=FALSE);
these two
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
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
2002 Dec 09
2
Principal component analysis
Dear R users,
I'm trying to cluster 30 gene chips using principal component analysis in
package mva.prcomp. Each chip is a point with 1,000 dimensions. PCA is
probably just one of several methods to cluster the 30 chips. However, I
don't know how to run prcomp, and I don't know how to interpret it's output.
If there are 30 data points in 1,000 dimensions each, do I have to
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
2012 Oct 31
3
Cannot rescale a constant/zero column error.
I am trying to run the R Script below, I have actually simplified it to just
this part that is causing issues. When I run this script I continue to get
an error that says "cannot rescale a constant/zero column to a unit
variance". I cannot figure out what is going on here. I have stripped down
my data file so it is more manageable so I can try to figure this out.
The data.txt file
2008 Jun 10
1
Concat Multiple Plots into one PNG figure
Dear experts,
I tried to put the two plots into one final PNG figure
with the following script.
However instead of giving 2 plots in one figure,
it only gives the the last plot in one figure.
What's wrong with my script below?
__BEGIN__
in_fname <- paste("mydata.txt.",sep="")
out_fname <- paste("finalplot.png",sep="")
dat <-
2010 May 15
2
Attempt to customise the "plotpc()" function
Dear R-list,
Among the (R-)tools, I've seen on the net, for (bivariate) Principal Component
scatter plots (+histograms), "plotpc" [1] is the one I like most.
By default it performs PCA on a bivariate dataset based on R's "princomp()"
(which is the eigenvector-based algebraic solution to PCA). I would like to
modify "plotpc()" in order be able, as an
2008 May 16
1
Dimensions of svd V matrix
Hi,
I'm trying to do PCA on a n by p wide matrix (n < p), and I'd like to
get more principal components than there are rows. However, svd() only
returns a V matrix of with n columns (instead of p) unless the argument
nv=p is set (prcomp calls svd without setting it). Moreover, the
eigenvalues returned are always min(n, p) instead of p, even if nv is set:
> x <-
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'
2007 Jan 30
2
R and S-Plus got the different results of principal component analysis from SAS, why?
Dear Rusers,
I have met a difficult problem on explaining the differences of principal
component analysis(PCA) between R,S-PLUS and SAS/STATA/SPSS, which wasn't
met before.
Althought they have got the same eigenvalues, their coeffiecients were
different.
First, I list my results from R,S-PLUS and SAS/STATA/SPSS, and then show
the original dataset, hoping sb. to try and explain it.
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