search for: mat3

Displaying 20 results from an estimated 30 matches for "mat3".

Did you mean: dat3
2008 Oct 03
2
suggestions for plotting 5000 data points
...nd pairs() function. The parallel function would have been perfect save for the large number of data (5000). The pairs() function doesn't show the difference explicitly. Does anyone have any suggestions on representing such data or have done similar plots? I attach some simulated data: mat3 <-matrix(sample(1:5000),nrow=5000,ncol=3, byrow=TRUE) colnames(mat3) <- c("human","mouse", "chicken") mat3 <-data.frame(mat3) mat2$model <- factor( rep( "Model 3"), labels="model3") ## code I used for parallel require(lattice) paral...
2009 Sep 09
2
Matrix multiplication and random numbers
...think I?m putting the for loop in the wrong place. Also when I try and save the matrices using write.table only the first one is saved The code so far is below, any help would be greatly appreciated Cheers Tom InitialPop<-matrix(c(500,0,0,0,0,0,0)) matmult<-function(InitialPop,N){ mat3<-matrix(c(0,rnorm(1,0.6021,0.0987),0,0,0,0,0,0,0,rnorm(1,0.6021,0.0987),0,0,0,0,1.9,0,0,rnorm(1,0.6021,0.0987),0,0,0,4.8,0,0,0,rnorm(1,0.6021,0.0987),0,0,9.7,0,0,0,0,rnorm(1,0.6021,0.0987),0,18,0,0,0,0,0,rnorm(1,0.6021,0.0987),32.6,0,0,0,0,0,0),nrow=7) for (i in 1:N){ PVAmatrix<-matrix(c(0,r...
2005 Apr 29
1
na.action
Hi, I had the following code: testp <- rcorr(t(datcm1),type = "pearson") mat1 <- testp[[1]][,] > 0.6 mat2 <- testp[[3]][,] < 0.05 mat3 <- mat1 + mat2 The resulting mat3 (smaller version) matrix looks like: NA 0 0 0 0 NA 0 NA 0 0 NA 2 0 0 2 NA To get to the number of times a '2' appears in the rows, I was trying to run the following code: numrow = nrow(mat3) counter &lt...
2012 Jun 14
0
fixed trimmed mean for j-group
...n1=15 n2=15 n3=15 n4=15 miu=0 sd1=1 sd2=1 sd3=1 sd4=1 a=rnorm(n1,miu,sd1) b=rnorm(n2,miu,sd2) c=rnorm(n3,miu,sd3) d=rnorm(n4,miu,sd4) ## data transformation g=0 h=0 w<-a*exp(h*a^2/2) x<-b*exp(h*b^2/2) y<-c*exp(h*c^2/2) z<-d*exp(h*d^2/2) mat1<-sort(w) mat2<-sort(x) mat3<-sort(y) mat4<-sort(z) alpha=0.15 k1=floor(alpha*n1)+1 k2=floor(alpha*n2)+1 k3=floor(alpha*n3)+1 k4=floor(alpha*n4)+1 r1=k1-(alpha*n1) r2=k2-(alpha*n2) r3=k3-(alpha*n3) r4=k4-(alpha*n4) ## j-group trimmed mean e1=k1+1 f1=n1-k1 e2=k2+1 f2=n2-k2 e3=k3+1 f3=n3-k3 e4=k4+1 f4=n4-k4 trim1=1...
2010 Mar 29
2
Need help on matrix manipulation
Dear all, Ket say I have 3 matrices : mat1 <- matrix(rnorm(16), 4) mat2 <- matrix(rnorm(16), 4) mat3 <- matrix(rnorm(16), 4) Now I want to merge those three matrices to a single one with dimension 4*3=12 and 4 wherein on resulting matrix, row 1,4,7,10 will be row-1,2,3,4 of "mat1", row 2,5,8,11 will be row-1,2,3,4 of "mat2" and row 3,6,8,12 will be row-1,2,3,4 of "ma...
2010 Jan 27
1
How to sort data.frame
Dear R heleprs   Suppose I have following data   Scenarios combination_names     series1    series2 Sc1 MAT2 GAU1 7.26554 8.409778 Sc2 MAT2 GAU2 7.438128 8.130275 Sc3 MAT3 GAU1 8.058422 8.06457 Sc4 MAT1 GAU2 8.179855 8.022071 Sc5 MAT3 GAU2 8.184033 8.191831 Sc6 MAT3 GAU2 7.50312 8.232425 Sc7 MAT1 GAU2 7.603291 8.200993 Sc8 MAT1 GAU1 8.221755 8.380097 Sc9 MAT3 GAU2 7.904908 8.088824 Sc10 MAT1 GAU3 7.67034 8.46376     I wish to sort thise data frame based on com...
2013 Feb 01
2
Nested loop and output help
...- X-cut1 Y2 <- Y-cut2 c3 <- cor(X2,Y2) mat2 <-cbind(X2,Y2) a11 <- ifelse( X < cut1 & Y < cut2, 1, 0) a12 <- ifelse( X < cut1 & Y >= cut2, 1, 0) a21 <- ifelse( X >= cut1 & Y < cut2, 1, 0) a22 <- ifelse( X >= cut1 & Y >= cut2, 1, 0) mat3 <-matrix(c(sum(a11),sum(a21), sum(a12),sum(a22)), nrow = 2) mat4 <-matrix(c(sum(a11),sum(a22), sum(a12),sum(a21)), nrow = 2) out3a <- mcnemar.test(mat3, correct=FALSE) out3b <- mcnemar.test(mat3, correct=TRUE) out4a <- chisq.test(mat4, correct = FALSE) out4b <- chisq.test(mat...
2012 Jul 07
0
fixed trimmed mean for group
...## data transformation > g=0 > h=0 > > w<-a*exp(h*a^2/2) > x<-b*exp(h*b^2/2) > y<-c*exp(h*c^2/2) > z<-d*exp(h*d^2/2) > > mat1<-sort(w) > mat2<-sort(x) > mat3<-sort(y) > mat4<-sort(z) > > alpha=0.15 > k1=floor(alpha*n1)+1 > k2=floor(alpha*n2)+1 > k3=floor(alpha*n3)+1 > k4=floor(alpha*n4)+1 > > r1=k1-(alpha*n1) > r2=k2-(alpha*n2) > r3=k3-(alpha*n...
2009 Nov 07
1
after PCA, the pc values are so large, wrong?
...emove the constant parameters mat1<-mat[,apply(mat,2,function(.col)!(all(.col[1]==.col[2:rownum])))] dim(yx.df) dim(mat1) #remove columns with numbers of zero >0.95 mat2<-mat1[,apply(mat1,2,function(.col)!(sum(.col==0)/rownum>0.95))] dim(yx.df) dim(mat2) #remove colunms that sd<0.5 mat3<-mat2[,apply(mat2,2,function(.col)!all(sd(.col)<0.5))] dim(yx.df) dim(mat3) #PCA analysis mat3.pr<-prcomp(mat3,cor=T) summary(mat3.pr,loading=T) pre.cmp<-predict(mat3.pr) cmp<-pre.cmp[,1:3] cmp DF<-cbind(Y,cmp) DF<-as.data.frame(DF) names(DF)<-c('y','p1',...
2008 Aug 29
2
Newbie: Examples on functions callling a library etc.
Hello R is pretty new to me. I need to write a function that returns three matrices of different dimensions. In addition, I need to call a function from a contributed package with the function. I have browsed several manuals and docs but the examples on them are either very simple or extremely hard to follow. Many thanks Ed [[alternative HTML version deleted]]
2013 Feb 13
3
date and matrices
Hi Elisa, Try this: date1<-format(seq.Date(as.Date("1991.1.1",format="%Y.%m.%d"),as.Date("1996.12.31",format="%Y.%m.%d"),by="day"),"%Y.%m.%d") ?length(date1) #[1] 2192 mat1<-matrix(c(.314,.314,.273,.273,.236,.236,.236,.236,.273,.314,.403,.314),ncol=1) res1<-
2010 Oct 14
1
rbind ing matrices and resetting column numbers
Sorry for the verbose example. I want to row bind two matrices, and all works except I want the column labelled "row" to be sequential in the new matrix, shown as "mat3" here, i.e. needs to be 1:6 and not 1:3 repeated twice. Any suggestions? Thanks J > colnm1 <- c("row","ti","counti") > colnm2 <- c("row","tj","countj") > mat1 <- matrix(c(1,7,9,2,8,5,3,7,9),byrow=T,nrow=3) > c...
2010 Mar 02
2
turn character string into unevaluated R object
...e below). Then, I want to turn the character string representing a file name (the evaluated expression of i) into an unevaluated R object. Basically, I want to create matrices whose names are the same as the related file names. Chees, Carol ---------------------------- suppose I have mat1, mat2, mat3 files v = list.files(".", all.files = F, pattern = "mat") for (i in v) assign(i, read.table(i, sep = "\t"), pos = 1) then, I want to have 3 objects with the names mat1, mat2, mat3 containing what mat1, mat2, mat3 files contain.
2009 May 19
3
how to calculate means of matrix elements
useR's, I have several matrices of size 4x4 that I want to calculate means of their respective positions with. For example, consider I have 3 matrices given by the code: mat1 <- matrix(sample(1:20,16,replace=T),4,4) mat2 <- matrix(sample(-5:15,16,replace=T),4,4) mat3 <- matrix(sample(5:25,16,replace=T),4,4) The result I want is one matrix of size 4x4 in which position [1,1] is the mean of position [1,1] of the given three matrices. The same goes for all other positions of the matrix. If these three matrices are given in separate text files, how can I writ...
2010 Jan 29
7
Simple question on replace a matrix row
Hello, I have a matrix mat1 of dim [1,8] and mat2 of dim[30,8], I want to replace the first row of mat2 with mat1, this is what I do: mat2[1,]<-mat1 but it transforms mat2 in a list I don't understand, I want it to stay a matrix... ----- Anna Lippel -- View this message in context: http://n4.nabble.com/Simple-question-on-replace-a-matrix-row-tp1427857p1427857.html Sent from the R help
2009 Sep 17
3
generating unordered combinations
Hi, I am trying to generate all unordered combinations of a set of numbers / characters, and I can only find a (very) clumsy way of doing this using expand.grid. For example, all unordered combinations of the numbers 0, 1, 2 are: 0, 0, 0 0, 0, 1 0, 0, 2 0, 1, 1 0, 1, 2 0, 2, 2 1, 1, 1 1, 1, 2 1, 2, 2 2, 2, 2 (I have not included, for example, 1, 0, 0, since it is equivalent to 0, 0, 1). I have
2003 Sep 15
2
Persp and color
How can I control de "wrap-around" color behaviour in the persp function ? I am using something like : persp(bb[1:100,2:97], col= rainbow(8,start=0.1, end=0.8))) Depending on the rainbow length value I get several "wrap-around" blocks of the selected color range...something that I wanted to avoid... My idea is to use the color in order to make a separation from a certain
2012 Nov 12
5
Matrix to data frame conversion
I have a matrix which I wanted to convert to a data frame. As I could not succeed and resorted to export to csv and reimport it again. Why did I fail in the attempt and how can I achieve what I wanted without this roundabouts? The original matrix: > str(comb_model0) num [1:90, 1:4] 3.5938 0.0274 0.0342 0.0135 0.0207 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:90]
2007 Nov 14
2
Generating these matrices going backwards
I have generated the following: x= E1 E2 E3 D1 0 0 1 D2 1 0 3 D3 0 2 0 y= E1 E2 E3 D1 0 0 1.75 D2 1.75 0 1.3125 D3 0 3.5 0 Where x and y are linked by: y =sum(x) * x / (rowSums(x)%o%colSums(x)) N=x[x[1:3,]>0] R=y[y[1:3,]>0] Now suppose I ONLY
2011 Apr 24
2
random roundoff?
...ing numerous matrix multiplications, I have a situation in in which the result depends on the nature of nearby I/O. Thus, with all arithmetic done with type double, and where values are mostly in the range [-1.0e0,+1.0e0] or nearby, I do: cerr << "some stuff" << endl; mat3 = matmult(mat1,mat2); I get a difference of the order 1.0e-15 depending on whether the cerr line does or does not end in "endl" as shown. I am imagining that there is some "randomness" in the roundoff that depends on the I/O situation. Is this credible? Any other suggestions...