similar to: matrix of higher order differences

Displaying 20 results from an estimated 8000 matches similar to: "matrix of higher order differences"

2004 Jan 12
1
Matrix indexes
Two questions about matrix indexing: Is is correct that V <- V[lower.tri(V, diag=TRUE)] returns the lower triangular of matrix V, that is: all elements above diagonal are set to zero? I understand that the triangle of matrix elements of V for which lower.tri is TRUE are returned while the others (above diagonal) are set to zero (or NA ???). If D and B are vectors of logicals, what
2010 Apr 30
2
Flattening and unflattening symmetric matrices
Here's an easy question: I'd like to convert a symmetric matrix to a vector composed of the upper.tri() part of it plus the diagonal, and convert it back again. What's the best way to achieve this? I'm wondering if there are some built in functions to do this easily. I can encode fine: v <- c(diag(A),A[upper.tri(A)]) but I don't see an easy way to recover A from v
2008 Nov 21
2
Extracting diagonal matrix
Dear All, I have a correlation matrix of size 100 x 100 and would like to extract the diagonal matrix from it. I have used the for loop to store tha correlation values of the diagonal matrix. Is there a 'R way' of doing this? Thanks in advance. Kind regards, Ezhil
2005 Jan 20
3
Constructing Matrices
Dear List: I am working to construct a matrix of a particular form. For the most part, developing the matrix is simple and is built as follows: vl.mat<-matrix(c(0,0,0,0,0,64,0,0,0,0,64,0,0,0,0,64),nc=4) Now to expand this matrix to be block-diagonal, I do the following: sample.size <- 100 # number of individual students I<- diag(sample.size) bd.mat<-kronecker(I,vl.mat) This
2006 Nov 10
4
Selective subsetting
Hi all, Here's an interesting (for me, at least!) problem I came across: I have a correlation matrix, let's say with 6 variables, A to F, as column headings and the same 6 as row headings. The matrix is filled with correlation coefficients. Therefore, the diagonal is all 1's, and each of the two triangles formed by the diagonal has the same 15 correlation coefficients. I need to
2011 Jan 20
2
splitting a square symmetric matrix
So many matrices are square symmetrical (i.e. variance-covariance matrices), is there any way to get R to split the matrix on its diagonal and just return one diagonal? So if I have mat<-matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) is there anyway to get the lower right diagonal instead of the entire symmetric matrix? -------------------------------------------
2011 Mar 15
1
Matrix building to remove for loops
Hello R users, I would like to reduce the number of for loops in my code. I build these matrices (50000 times). The main diagonal are 1s and the two sides along the main diagonal mirror each other as follows: i<-5 fi<-matrix(0,nrow=i,ncol=i)#floral inhibition matrix for(r in 1:i){ for(c in 1:i){ if(r==c){ fi[r,c]<-1 }else if(r<c){ fi[r,c]<-1-runif(1)^.5 }else{ fi[r,c]<-fi[c,r]
2016 Jan 16
2
heatmap de matriz diagonal inferior
Tengo una matriz de de datos (correlaciĆ³n) entre pares de muestras, de tipo diagonal inferior, de 250 y quisiera hacer un heatmap y/o un dendrograma. Soy un poco novato y me encuentro con el problema que no se como "importarla" para cargarla e indicar que se trata de una matriz de datos de tipo "diagonal inferior" para que R lo interprete y poder realizar un heatmap y/o
2012 Feb 15
3
built a lower triangular matrix from dataframe
Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. The matrix I have to construct has 203 rows and 203 columns and that makes 20503 values to be included within (that's why I can't do it manually). To illustrate the dataframe I have, I'll give you an example of a dataframe and matrix with dimensions 6x6 (to make it
2003 May 22
7
extract half a matrix
Dear all, I'm new to matrix operations in R. I couln't find a solution to the following problem among earlier help mails or in An introd to R, I guess because the question is really basic. I want to extract all above the diagonal, i.e. from 1 2 3 4 1 0 26 49 49 2 26 0 44 40 3 49 44 0 21 4 49 40 21 0 I want 26 49 44 49 40 21 Thanks in advance! Sincerely, Tord
2005 Mar 31
4
NA's?
Your message doesn't help us very much. You haven't said what kind of calculation it is you want to do, and that certainly matters. For example, for some kinds of computations the solution you started below would work fine: > M <- matrix(1:16, 4, 4) > is.na(diag(M)) <- TRUE > M [,1] [,2] [,3] [,4] [1,] NA 5 9 13 [2,] 2 NA 10 14 [3,] 3 7 NA
2011 Dec 23
1
Help creating a symmetric matrix?
Hi, I am trying to work with the output of the MINE analysis routine found at http://www.exploredata.net Specifically, I am trying to read the results into a matrix (ideally an n x n x 6 matrix, but I'll settle right now for getting one column into a matrix.) The problem I have is not knowing how to take what amounts to being one half of a symmetric matrix - excluding the diagonal -
2011 Jun 02
4
generating random covariance matrices (with a uniform distribution of correlations)
List members, Via searches I've seen similar discussion of this topic but have not seen resolution of the particular issue I am experiencing. If my search on this topic failed, I apologize for the redundancy. I am attempting to generate random covariance matrices but would like the corresponding correlations to be uniformly distributed between -1 and 1. The approach I have been using is:
2011 Jan 25
1
NA printing
Hi. I'm writing a print method for an object that includes a numeric matrix for which the lower diagonal elements are not meaningful. So I make the lower diagonal of my matrix NA and print it. But my co-author does not like NA there and wants a dash. I have tried coercing the matrix to character, essentially by M[is.na(M)] <- "-" but this interferes with the pleasing column
2006 Jan 27
3
[Q] extracting lower diagonal elements of a matrix
Hi R users I like to extract lower diagonal elements of a matrix in such a way like, data[1,2], data[1,3], ...., data[5,6] are extracted from a matrix called 'data' This short script below is what I have written so far. ########################################## data <- matrix(rnorm(36,0,1),nrow=6) temp<-c() for (i in 1:(nrow(data)-1)) { for (j in (i+1):nrow(data)) {
2007 Nov 29
1
?eigen documentation suggestion
from ?eigen symmetric: if 'TRUE', the matrix is assumed to be symmetric (or Hermitian if complex) and only its lower triangle is used. If 'symmetric' is not specified, the matrix is inspected for symmetry. I think that could mislead a naive reader as it suggests that, with symmetric=TRUE, the result of eigen() (vectors and values) depends only on
2011 Sep 26
2
Triangular matrix upper to down
Hi, suppose that we have a triangular upper matrix A test <- matrix(ncol = 4, nrow = 4) test[1, ] <- c(NA,1,1,1) test[2, ] <- c(NA,NA,1,1) test[3, ] <- c(NA,NA,NA,1) test[4, ] <- c(NA,NA,NA,NA) I know how quickly set diagonal value diag(test) <- 1. But how quickly set down value i.e. matrix is symmetrical? Is there in r project any quickly function? Thanks, Best Marcin
2005 Mar 01
2
almost lower triangular matrices
I have output from a program which produces a distance matrix I want to read into a clustering program in R. The output is a .txt file and is 'almost' lower triangular in the sense that it is just the triangle below the diagonal. So for example a 4-by-4 distance matrix appears as, 1 2 3 4 5 6 i.e. it looks like a lower triangular of a 3-by3. I thought I might be able
2006 Feb 05
3
reading in a tricky computer program output
Hi R user I need to read in some values from a computer program output. I can't change the output format because the developer of the program doesn't allow to change the format of output. There are two formats. First one looks like this if I have 10 variables, ------------------------------------------------------------------------------------------------------ [ 1]
2004 Oct 17
2
Plotcorr: colour the ellipses to emphasize the differences
Hello R users! I began with R and I must say that it is really nice. I have data with a lot of variables and have a problem to extract the pattern from correlation matrix. So I tried with plotcorr and it went fine. While I was reading the help page of this function, I found that ellipse display can be even better with use of different colors (the code is bellow). However I have a problem to