similar to: Ordering every row of a matrix while ignoring off diagonal elements

Displaying 20 results from an estimated 400 matches similar to: "Ordering every row of a matrix while ignoring off diagonal elements"

2004 Oct 13
2
diagonal matrix construction
Hi, I have worked long and hard and looked in the manuals and am having a hard time constructing a diagonal matrix. I can get the diagonals out of a matrix but can't construct the matrix with just the diagonals. I have been on the web site and manuals and I think that it says to use: dsj <- diag (three = 1, nrow, ncol = 7) three is the name of my matrix and
2010 Apr 23
2
Matrix diagonal help
Hi Suppose I have a matrix (cohort are rows and years are columns) [2000] [2001] [2002] [2003] [C1] 0.01 0.03 0.02 0.09 [C2] 0.06 0.05 0.07 0.11 [C3] 0.1 0.5 0.4 0.98 [C4] 0.7 0.6 0.2 0.77 I want to extracts the diagonals to get a matrix which looks like this (C1 becomes C2 in 2002, C2 becomes C3 in 2003
2009 Aug 24
1
Filling matrix secondary diagonal
Hi, how do i fill the secondary diagonals of a matrix? Is there an funktion like the "diag" funktion in matlab, where i can specify the diagonal i?d like to fill? -- View this message in context: http://www.nabble.com/Filling-matrix-secondary-diagonal-tp25121745p25121745.html Sent from the R help mailing list archive at Nabble.com.
2010 Mar 01
1
function odiag(): assigning values to off-diagonal
hi I'm trying to use the function odiag(x) for matrix calculations. I would like to assign new values to an off-diagonal in a matrix. When I use the diag (x) function I could write something like p<-matrix(seq(1:12),ncol=4) p.new<-matrix(rep(0,12),ncol=4) diag(p.new)<-diag(p) p.new But this won't work with odiag. How can I turn odiag (x) into something like diag (x) in order
2011 Dec 08
2
Relationship between covariance and inverse covariance matrices
Hi, I've been trying to figure out a special set of covariance matrices that causes some symmetric zero elements in the inverse covariance matrix but am having trouble figuring out if that is possible. Say, for example, matrix a is a 4x4 covariance matrix with equal variance and zero covariance elements, i.e. [,1] [,2] [,3] [,4] [1,] 4 0 0 0 [2,] 0 4
2011 Jul 19
2
Taking all "complete" diagonals of a matrix
Hi R-Help! I am trying to find a nicer way of extracting all the "complete" diagonals of a matrix. I am working with very large matrices that have many more rows than columns. I want to be able to extract each of the diagonals that are as long as the number of columns in the matrix. I have written a rather ugly function that presently does the job. It illustrates what I am trying to
2011 Feb 25
1
Accessing sub diagonals / spdiag in R ?
Hello, I'm attempting to access a specific number of sub diagonals in a MATRIX and have been accustomed to using spdiags in MATLAB or Octave. I've got a solution pieced together using for loops and it works though isn't vectorized and liable to run very slow for large matrices. As an example: A = 1 2 3 4 5 9 8 7 6 5 4 5 6 7 8 5 4 3 2 1 8 7 6 0 1 The subdiagonals are: 9,5,3,0 4,4,6
2007 Jun 20
1
How to extract diagonals
Hello, I am using Mac OS X on a power book and R 2.5.0 I try to extract a diagonal from a dissimilarity matrix made with dsvdis, with this code: diag(DiTestRR) But I get this error message: Fehler in array(0, c(n, p)) : 'dim' spezifiziert ein zu großes Array english: Error in array(0, c(n, p)) : 'dim' specifies a too big array. Is there a limit to extract diagonals? I
2001 May 19
2
calculations on diagonals of a matrix
Given an nxm matrix A I want to compute the nxm matrix B whose ij-th element is the sum of the elements of A lying on the diagonal that ends with element ij, i.e., b_ij = a_ij + a_(i-1)(j-1) + a_(i-2)(j-2) + ... In APL (which I no longer use), I would use the 'rotate' operator to derive an array whose columns are diagonals of the given array and then cumulate down columns. Is
2007 Jul 26
0
Diagonal Submatrices Extraction
Yes you are right ... an example is mandatory. So ... I have a matrix of 0 with just a single 1 per row and per column I need to extract all maximal 'diagonal' submatrices Let's say I have the following matrix A B C D E a 0 1 0 0 0 b 1 0 0 0 0 c 0 0 1 0 0 d 0 0 0 1 0 e 0 0 0 0 1 well I would like to get, for this example, the two following submatrices A B C D E
2013 Jan 23
2
setting off-diagonals to zero
The following 1460 x 1460 matrix can be throught of as 16 distinct 365 x 365 matrices. I'm trying to set off-diaganol terms in the 16 sub-matrices with indices more than +/- 5 (days) from each other to zero using some for loops. This works well for some, but not all, of the for loops. The R code I"m using follows. For some reason the third loop below zero's-out everything in the
2008 Feb 26
2
Summing up diagonals w/o for-loop
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080226/43b3a38b/attachment.pl
2007 Oct 10
3
as.dist with diagonal unequal zero
Hello and sorry that I still haven?t found a solution for my problem. I need to extract the lower and upper triangle from a square matrix including the diagonal. This diagonal is not zero in that special case. I tried with as.dist w<-as.dist(w, diag = TRUE) > w 1 2 3 4 5 1 0 2 2 0 3 3 8 0 4 4 9 14 0 5 5 10 15 20 0 but found no way to keep the diagonal that is in the
2005 Feb 04
4
Building a Matrix
Dear List: I am having some difficulty constructing a matrix that must take a specific form. The matrix must be have a lower block of non-zero values and the rest must all be zero. For example, if I am building an n X n matrix, then the first n/2 rows need to be zero and the first n/2 columns must remain as zero with all other elements having a non-zero value that I specify. For example, assume
2009 Nov 08
2
influence.measures(stats): hatvalues(model, ...)
Hello: I am trying to understand the method 'hatvalues(...)', which returns something similar to the diagonals of the plain vanilla hat matrix [X(X'X)^(-1)X'], but not quite.  A Fortran programmer I am not, but tracing through the code it looks like perhaps some sort of correction based on the notion of 'leave-one-out' variance is being applied. Whatever the
2010 Oct 21
4
how do I make a correlation matrix positive definite?
Hi, If a matrix is not positive definite, make.positive.definite() function in corpcor library finds the nearest positive definite matrix by the method proposed by Higham (1988). However, when I deal with correlation matrices whose diagonals have to be 1 by definition, how do I do it? The above-mentioned function seem to mess up the diagonal entries. [I haven't seen this complication, but
2012 Apr 12
3
writing spdiags function for R
Dear R-list, I am in the process of translating a long function written in Matlab into R (mainly because I am a big of fan of R, and folks will not have to pay to use it :). In the translation of this function I got stack because they use spdiags, which, as far as I can tell it is not available in R. I have explored the Matrix package, from which I borrowed some of the functions (e.g.,
2008 Jul 10
1
problems with rq.fit.sfn
Dear all, I am running a quantile estimation with Sparse matrix and when I run the procedure rq.fit.sfn I receive the following warning: tiny diagonals replaced with Inf when calling blkfct. Does anyone knows exactly what does it mean? What's this kind of error? Should I get worried about this message? The matrix I use is a full rank matrix (and indeed I do not have any message about
2004 Jun 25
1
text, pos suggestion
suggestion: could the R team please add positions 5 through 8 for the arg parameter in text(), which would select the diagonals (northeast, southeast, southwest, northwest)? sincerely, /ivo welch PS: thanks for all the earlier circle help. knowing some of the predispositions of the R developers, I probably should not suggest adding to the documentation > ?circle please see
2004 May 06
1
modifying the text size in splom
All, I have long variable names that are being fed through splom (R 1.8.1). I'd like to resize the text printed on the diagonals to better display the names (unless anyone can suggest another approach - creative use of varnames). I've looked at the code, R-Help, ?splom and the Trellis User's Guide to no avail. Any suggestions? Thanks in advance, Max Kuhn, Ph.D. Becton Dickinson