similar to: Conditional Matrices

Displaying 20 results from an estimated 20000 matches similar to: "Conditional Matrices"

2005 Jun 02
3
merge large matrices
Dear List I have two large matrices A and B. Both have the same dimensions, let's say 20k x 30k. About half the cells of B are missing. Now I'm looking for an efficient way to merge them, so that the missing values in B are replaced by the corresponding values of A. Matrix A [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 merged with Matrix B [,1] [,2] [,3] [1,] 10 NA NA [2,] NA 50 60
2005 May 10
4
summary statistics for lists of matrices or dataframes
Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example: > z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2)) > z [[1]] [,1] [,2] [1,] 2 2 [2,] 2 2 [[2]] [,1] [,2] [1,] 4 4 [2,] 4 4 > I would like to calculate, for example, the mean value for each cell. I can do that the hard
2008 Nov 15
2
creating matrices from vectors
If I have 4 vectors (a, b, c, and d) each of length 1000, how do I then create 1000 two by two matrices from these vectors, such that: myMatrix[i] = matrix(c(a[i],b[i],c[i],d[i]),2) Then I'd like to create a single vector containing the largest eigenvalues of each matrix? (Sorry I am quite new to R) Many thanks, James _________________________________________________________________
2006 Feb 20
1
var-covar matrices comparison:
Hi, Using package gclus in R, I have created some graphs that show the trends within subgroups of data and correlations among 9 variables (v1-v9). Being interested for more details on these data I have produced also the var-covar matrices. Question: From a pair of two subsets of data (with 9 variables each, I have two var-covar matrices for each subgroup, that differ for a treatment on one
2005 Aug 20
2
diagonal matrices
Hello all, I have matrices V.i of dimension n.i x n.i, where i = 1, ..., J, and the sum of n.i equals N. (and n.i ! = n.j) goal: create one large matrix V, where V has matrices V.i on diagonal. I create each matrix V.i in a for loop (1 to J), so each time I'd like to augment V with the most recently calculated V.i, such that I'll have V after the final iteration of the for loop.
2004 Nov 16
5
Difference between two correlation matrices
Hi Now a more theoretical question. I have two correlation matrices - one of a set of variables under a particular condition, the other of the same set of variables under a different condition. Is there a statistical test I can use to see if these correlation matrices are "different"? Thanks Mick
2007 May 21
3
an array of matrices
I'd like to have a three dimensional array of matrices. I thought I could construct a five dimensional array to have the three dimensional array of matrices. However, not all of the matrices in the array have the same dimensions, which seems to mean I can't use a five dimensional array. What I'd like is this: A = matrix(1:4,2,2) B = matrix(1:25,5,5) C = matrix(1,3,3) D =
2009 Jul 20
3
Write in file matrices of sifferent size
Hi list, How to save a list content into a text file? Please consider example below, I have two numeric matrices that I bundle into a list & give each list element a name Example: > matrixA <- matrix(0,5,4) > matrixB <- matrix(1,7,13) > matrixList <- list(matrixA,matrixB) > names <- c("Matrix A","Matrix B") > names <-
2009 Jul 14
2
averaging two matrices whilst ignoring missing values
Hi folks, I'm trying to do something that seems like it should easy, but it apparently isn't. I have two large matrices, both containing a number of missing values at different cells. I would like to average these matrices, but the NAs are preventing me. I get a "non-numeric argument to binary operator" error. That's the first problem.
2011 Apr 20
2
get cells by the combination of their column and row names
Hi, I have a (correlation) matrix and I want to select a subset of its cells depending on the combination of their column and row names. This illustrates my problem: mtrx <- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3, ncol=3, dimnames = list(c('c132','c432', 'c233'), c('r132','r233', 'r432')))> mtrx r132 r233 r432c132 1 4 7c432 2
2012 Mar 07
1
extract same columns and rows in two matrices
Hello, I have two matrices. They both have different row names and column names, but they have some common row names and column names. The row names and column names that are the same are what I am interested in. I also want the columns in the two matrices aligned the same. In the end, I need to do rd[1,1] and ua[1,1], for example and be accessing the same column and row for both matrices. Thank
2003 Oct 06
1
visualizing transition probability matrices
Dear List, I have a couple of (~200) 3x3 transition probability matrices (ie each defines a Markov chain). They are all estimated from the same underlying process, so it ie meaningful to take their elemetwise mean and standard deviation. [1] First question: supposing that they are given in a list l, how do I get their elementwise mean and standard deviation? Fortunately, the mean of trans. prob.
2012 Nov 09
1
Mean of matrices entries in list of lists
Hey there, I've got a list of lists with matrices: A list with 13 entries (representing years), each of them another list with 12 matrices (representing one month). In each matrix there are as many rows as there are hours in the different months and 2 columns, since two meteorological parameters are measured. What I want to do is to calculate the hourly mean values for each month over the
2010 Nov 17
2
slicing list with matrices
A list contains several matrices. Over all matrices (list elements) I'd like to access one matrix cell: m <- matrix(1:9, nrow=3, dimnames=list(LETTERS[1:3], letters[1:3])) l <- list(m1=m, m2=m*2, m3=m*3) l[[3]] # works l[[3]][1:2, ] # works l[[1:3]][1, 1] # does not work How can I slice all C-c combinations in the list? S?ren -- S?ren Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag,
2013 Mar 22
1
Median across matrices
Hey all, I have a list of matrices. I'd like to calculate the median across all those matrices for each element. What I'd like to end up with is a matrix containing the median of all [1,1] [1,2] etc. elements across all matrices. Is there a concise way of doing that? Thanks!
2001 Sep 11
1
[Q] Sparse Matrices in R?
Does anyone knows if there is a way to handle sparse matrices in R? More precisely I am looking for a way to do correspondance analysis on a contingency table which is quite huge (1,000 x 10,000) but sparse (i.e. full of zero). Creating it directly in R (eg as x <- array(0,c(1000,10000) then filling the non zero cells) seems definitely not the good solution as R is then unable to process it
2011 Nov 03
2
Take variables in data.frame and create list of matrices
Hi, I have this sample data below and would like to create a list of matricies. setseed(1254) id <- c(1,1,1,1 ,2,2,2) o <- as.factor(c(1:4, 1, 3, 4)) r <- rep(.5, 7) v <- rnorm(7) s <- rnorm(7) dat <-data.frame(id, o, r, v, s) dat #> dat # id o r v s # 1 1 0.5 0.7024631 2.0813672 # 1 2 0.5 -0.5541955 0.1095156 # 1 3 0.5 -1.0418167 0.4164930 # 1
2014 Aug 06
2
Subscripting Matrices
There seems to be a result type difference when subscripting a 6 x 1 matrix as compared to a 3 x 2 matrix that is caused by the ncol = 1 compared to ncol > 1. > ThinMatrix <- matrix(1:6,ncol=1) > ThinMatrix [,1] [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 [6,] 6 > FatMatrix <- matrix(1:6,ncol=2) > FatMatrix [,1] [,2] [1,] 1 4 [2,] 2 5
2012 Apr 25
1
Proper apply function for matrices embedded in lists
Hi: I have a small problem that I'm not quite sure how to figure out. I've generated some randomized (permutated) data which consists of nrows=3 by ncols=165 (see below) per element (3 x 165 = 495 sub-elements). [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]....... [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [2,]
2006 Jun 27
1
Adding elements of matrices of different dimensions
If I have two matrices: > a<-matrix(1:5,ncol=1) [,1] [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 > b<-matrix(1:50,ncol=10) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 6 11 16 21 26 31 36 41 46 [2,] 2 7 12 17 22 27 32 37 42 47 [3,] 3 8 13 18 23 28 33 38 43 48 [4,] 4 9 14 19