Displaying 20 results from an estimated 2000 matches similar to: "Cannot rescale a constant/zero column error."
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'
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
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
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 Jan 04
1
PCA error: svd(x, nu=0) infinite or missing values
Hi,
I am trying to do a PCA on my data but I keep getting the error message
svd(x, nu=0) infinite or missing values
>From the messages posted on the subject, I understand that the NAs in my
data might be the problem, but I thought na.omit would take care of that.
Less than 5% of my cells are missing data. However, the NAs are not
regularly distributed across my matrix: certain cases and
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
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
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
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
2000 Dec 01
1
simple (NEWBIE) question re: prcomp or princomp
Hi,
I am a new user of R, and apologize beforehand for the simplistic nature of this question:
I ran prcomp on a data set with 4 variables, and am able to see the summary information (variance contribution, rotation matrix, plots, etc.). However, I'd also like to extract the actual values of the principal components (PC) corresponding to each sample. I've looked in the help, on-line
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
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.
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 Jun 15
1
Getting the eigenvectors for the dependent variables from principal components analysis
Dear listserv,
I am trying to perform a principal components analysis and create an output table of the eigenvalues for the dependent variables. What I want is to see which variables are driving each principal components axis, so I can make statements like, "PC1 mostly refers to seed size" or something like that.
For instance, if I try the example from ?prcomp
> prcomp(USArrests,
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:
2006 May 13
2
windows( ... ,rescale="fixed") bug (PR#8857)
Full_Name: Gerhard Thallinger
Version: 2.3.0; 2.2.0
OS: Windows XP
Submission from: (NULL) (212.183.54.87)
Invoking windows() with the parameter rescale="fixed" followed by plot.new()
or any other plot command causes very often the following error:
windows(width=7, height=7, rescale="fixed");plot.new()
Error in plot.new() : outer margins too large (fig.region too small)
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
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 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 <-
2013 Mar 14
2
Same eigenvalues but different eigenvectors using 'prcomp' and 'principal' commands
Dear all,
I've used the 'prcomp' command to
calculate the eigenvalues and eigenvectors of a matrix(gg).
Using the command 'principal' from the
'psych' packageĀ I've performed the same exercise. I got the same
eigenvalues but different eigenvectors. Is there any reason for that
difference?
Below are the steps I've followed:
1. PRCOMP
#defining the matrix