search for: retx

Displaying 20 results from an estimated 32 matches for "retx".

Did you mean: ret
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 0.6616550 -0.2879790 0.4913755 0.1256...
2002 Oct 29
0
patch to mva:prcomp to use La.svd instead of svd (PR#2227)
...(This is really a feature enhancement, but submitted to R-bugs to make sure it doesn't get lost. ) *** R-1.6.0/src/library/mva/R/prcomp.R Mon Aug 13 17:41:50 2001 --- R-1.6.0-GRW//src/library/mva/R/prcomp.R Tue Oct 29 11:57:23 2002 *************** *** 1,18 **** prcomp <- function(x, retx = TRUE, center = TRUE, scale. = FALSE, ! tol = NULL) { x <- as.matrix(x) x <- scale(x, center = center, scale = scale.) ! s <- svd(x, nu = 0) if (!is.null(tol)) { rank <- sum(s$d > (s$d[1]*tol)) if (rank < ncol(x)) !...
1998 Apr 24
1
Warning: ignored non function "scale"
...> 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 error message and still keep the name scale for both the argument and the name of the function? Paul Gilbert ______ prcomp <- function(x, retx=TRUE, center=TRUE, scale=FALSE) { s <- svd(scale(x, center=center, scale=scale),nu=0) # rank <- sum(s$d > 0) rank <- sum(s$d > (s$d[1]*sqrt(.Machine$double.eps))) if (rank < ncol(x)) s$v <- s$v[,1:rank] s$d <- s$d/sqrt(max(1,nrow(x) -1)) if(retx) list(sdev=s$d, rotation...
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. So my question is how can i create this matrix from the results of the PCA. (Maybe there is also a faster method available for PCA?) Any answers o...
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 loadings. x if retx is true the value of the rotate...
2004 Nov 14
2
Exporting to file: passing source name to file name in loop
...te a movie from them. Please could someone tell me where I am going wrong? the following code works fine and outputs to screen: fun_pca_vector_movie_plot<-function(x,y,z,t){ zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ pca<-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ image(east,north,t(map.matrix),col=my.colors,axes=T, xlab="",ylab="") text(y[,3],y[,2],labels=as.character(y[,1])) title(paste("Component",i,"Step:"))...
2007 Apr 12
2
Asterisk 1.2.17 and Cisco 7940/SIP: bug or what?
...8 101 c=IN IP4 10.0.10.136 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:18 G729/8000 a=fmtp:18 annexb=no a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=sendrecv sipTransportSendMessage: Closed a one-time UDP send channel handle = 8 LINE 0/1: sipTransportSendMessage : Stopping reTx timer LINE 0/1: sipTransportSendMessage : Starting reTx timer (500 msec) CHANGE STATE: LINE 0/1: : State change: SIP_STATE_IDLE -> SIP_STATE_SENT_INVITE SIPTaskProcessListEvent: cmd = 0x160200 SIPProcessUDPMessage: recv UDP message from <10.0.10...
2005 Feb 03
0
Interpretation of PC loadings
...ffect artificially doubling the number of variables, then perform the pca, subsequently repairing the output and plotting the paired site loadings onto a geographical map and interpreting the plotted vectors as dominant wind flow patterns. I have followed their approach, using prcomp() in R, using retx=FALSE and plotting the pairings from the pca$rotation output. When I replot these vectors onto a map it seems that a spurious angle has been introduced into the data (ie the data seem to be angled at approx 45 degrees from where I would expect them to lie). Due to this I've also tried switchin...
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 values are different > min(d2-d1) [1] -1.976152 > max(d2-d1) [1] 1.535222 However, if I do th...
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 size 275.6 Mb" I tried to increase the memory size : "memory.size(4000)" but it did not work, is there a solution for this ? or is there another software that can handle large data sets....
2008 Jun 10
1
Concat Multiple Plots into one PNG figure
...ng with my script below? __BEGIN__ in_fname <- paste("mydata.txt.",sep="") out_fname <- paste("finalplot.png",sep="") dat <- read.table(in_fname, comment.char = "!" , na.strings = "null"); dat.pca <- prcomp(dat[,1:ncol(dat)], retx=TRUE, scores=TRUE) trellis.device("png", color=TRUE) png(out_fname) # End figure expected to be 1 row 2 columns par(mfrow = c(1,2)) # Two plots which I want to put into one PNG figure xyplot(dat.pca$x[,1] ~ dat.pca$x[,2], xlab="First Component", ylab="Second Component&qu...
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
2011 Sep 28
0
PCA: prcomp rotations
Hi all, I think I may be confused by different people/programs using the word rotation differently. Does prcomp not perform rotations by default? If I understand it correctly retx=TRUE returns ordinated data, that I can plot for individual samples (prcomp()$x: which is the scaled and centered (rotated?) data multiplied by loadings). What does it mean that the data is rotated from the "?prcomp" description? Is this referring to the data matrix orientation (i.e. loo...
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
1998 Aug 26
0
prcomp & princomp - revised
...at this argument is passed to cor or cov, which are not called if svd is used. ############## prcomp.R replacement file ############## screeplot <- function(x, ...) {UseMethod("screeplot")} plot.prcomp <- function(x, ...) {screeplot(x, ...)} prcomp <- function(x, retx=TRUE, center=TRUE, scale=FALSE) { # s <- svd(scale(x, center=center, scale=scale),nu=0) # above produces warning since scale is both a function and a variable so s <- svd(get("scale",envir=.GlobalEnv) (x, center=center, scale=scale),nu=0) # rank <- sum(s$d > 0) rank <-...
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
2011 Jul 29
1
Limited number of principal components in PCA
...a (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: test_pca_Q<-prcomp(~.,data=Q,scale.=TRUE,retx=FALSE,na.action=na.omit) It is outputting 54 'standard deviation' numbers (which are the sqrt(eigenvalues) in respect to a certain PC, am I correct?), and 54 'rotation' numbers, which are the variable loadings with respect to a given PC. I have two questions: 1.) Why is it only o...
2006 Feb 20
1
Further rgl()/spheres3d() query
...color (in this case "red") for the first argument. The sphere from the second argument appear as flat dark circles. Also the text3d() command only seems to work for a couple of the positions, with no text added in most cases. Could anyone offer any suggestions? g.pca <- prcomp(RtG , retx = TRUE) scale <- 0.4 bg3d("black") amp <- 6 zlim <- amp*range(z) zlen <- (zlim[2] - zlim[1])*100 colorlut <- terrain.colors(zlen) # height color lookup table col <- colorlut[ ((z*amp)-zlim[1])*100+1 ] # assign colors to heights surface3d(x,y,z*amp,color=col) for...
2010 Nov 10
2
prcomp function
...(i.e., a matrix whose columns contain the eigenvectors). The function princomp returns this in the element loadings. ..." Now please take a look at the following easy example: first I define a matrix A >A<-matrix(c(0,1,4,1,0,3,4,3,0),3,3) then I apply PCA on A >trans<-prcomp(A,retx=T,center=F,scale.=F,tol=NULL) >eval<-trans$sdev*trans$sdev #eval is the vector of the eigenvalues of cov(A) (according to the cited help text above) >evec<-trans$rotation #evec is the matrix with the eigenvectors of cov(A) as columns (according to the cited help text above) now the...
2011 Dec 10
3
PCA on high dimentional data
...: 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 new data frame new_data_frame<- cbind(data_after_pca$x[,1], data_after_pca$x[,2], data_after_pca$x[,3]); After the PCA, in the new_data_frame, i loose the previous cond1, cond2, cond3 labels, and inste...