Displaying 20 results from an estimated 10000 matches similar to: "how to extract the maximum from a matrix?"
2005 Feb 21
5
Compare rows of two matrices
Hello,
#I have two matrices, eg.:
y <- matrix( c(20, NA, NA, 45, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 )
x <- matrix( c(20, NA, NA, NA, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 )
#Whereas x contains all NA?s from y plus some additional NA?s.
#I want to find the index of these additional NA?s. I think, there must be a very
2008 Jun 11
4
Matrix transformation problem
ng,
I have a matrix (x) with binary content. Each row of the matrix holds exactly one 1, and the rest of the row is zeros. The thing is that I need to 'collapse' the matrix to one column where each row holds the original column index of the 1's (y). Sometimes, the matrix is quite large, so I have a perfomance problem.
x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0,
2006 Nov 03
3
identify extremes positions of values into matrix
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20061103/39e6883b/attachment.pl
2006 Feb 14
3
Inf values in a matrix
Hello,
I have some Inf values in a matrix, but I don't want to replace them with
some value but rather remove the rows that contain the Inf values. Also I
would like to record the rows which were removed. Is there an easy way to
do this instead of writing loops over the matrix? Thanks.
Ita Cirovic Donev
2006 Sep 26
1
Voung test implementation in R
Dear All,
I would like to know if the Voung test (Voung; Econometrica, 1989) to compare two non-nested regression models has been implemented in R.
Thanks in advance for your assistance,
mirko
[[alternative HTML version deleted]]
2006 Nov 19
4
The most common row in a matrix?
Hi,
How do you get the most common row from a matrix? If I have a matrix
like this
array(1:3,dim=c(4,5))
[,1] [,2] [,3] [,4] [,5]
[1,] 1 2 3 1 2
[2,] 2 3 1 2 3
[3,] 3 1 2 3 1
[4,] 1 2 3 1 2
in which rows 1 and 4 are similar, I want to find that vector c
(1,2,3,1,2).
Atte Tenkanen
University of Turku, Finland
2007 Mar 08
2
Removing duplicated rows within a matrix, with missing data as wildcards
I'd like to remove duplicated rows within a matrix, with missing data
being treated as wildcards.
For example
> x <- matrix((1:3), 5, 3)
> x[4,2] = NA
> x[3,3] = NA
> x
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
[3,] 3 2 NA
[4,] 1 NA 2
[5,] 2 1 3
I would like to obtain
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
2004 Aug 25
6
R-help
Dear R users,
I have just start working with R and would need some help.
If you have a matrix as:
[,1] [,2] [,3]
[1,] 11 24 11
[2,] 16 29 16
[3,] 2 15 2
and you want the position where you can find the maximum value, in this
case row 2 and column 2.
How could you get the position?
The values in the matrix is likelihood function values, and each row and
2006 May 12
3
Maximum likelihood estimate of bivariate vonmises-weibulldistribution
Thanks Dimitris!!! That's much clearer now. Still have a lot of work to
do this weekend to understand every bit but your code will prove very
useful.
Cheers,
Aziz
-----Original Message-----
From: Dimitrios Rizopoulos [mailto:Dimitris.Rizopoulos at med.kuleuven.be]
Sent: May 12, 2006 4:35 PM
To: Chaouch, Aziz
Subject: RE: [R] Maximum likelihood estimate of bivariate
2005 Mar 16
8
Summing up matrices in a list
Dear all,
I think that my question is very simple but I failed to solve it.
I have a list which elements are matrices like this:
>mylist
[[1]]
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
[[2]]
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
I'd like to create a matrix M<-mylist[[1]]+mylist[[2]]
[,1] [,2] [,3]
[1,] 8 12 16
[2,] 10 14 18
2006 Jan 12
1
t-test for standard deviations
Dear R-users,
I am new to the list and I would like to submit (probably!!!!) a stupid question:
I found in a paper a reference to a t-test for the evaluationg the difference between the standard deviations of 2 samples.
This test is performed in the paper but the methodology is not explained and any reference is reported.
Does anyone know where I can find references to this test and if it is
2008 Jun 17
5
How to control height of abline
I use matplot to get the density curve and then I use
abline(v=g$V2, col = 3 ) to get the vertical line.
Goal : I want very small lines at the bottom on the x axis , if possible in the arrow forms instead of vertical lines on the whole graph.
Thanks a lot.
[[alternative HTML version deleted]]
2007 Feb 22
3
List filtration
Hello R-ologists,
Imagine you have a list "list" like so:
>list
[[1]]
[1] "IPI00776145.1" "IPI00776187.1"
[[2]]
[1] "Something" "IPI00807764.1" "IPI00807887.1"
[[3]]
[1] "IPI00807764.1"
[[4]]
[1] "Somethingelse"
What I need to achieve is a filtered list "list2" like so:
>list2
[[1]]
[1]
2008 Mar 10
1
How can I sample from a two-dimensional grid of points
Hi everyone,
My goal is to sample from a two-dimensional grid. Consider the following example of code:
n.grid <- 500
muA.grid <- seq(-4,4, length=n.grid)
muB.grid <- seq(-4,4, length=n.grid)
mu.p <- matrix(NA, nrow=n.grid, ncol=n.grid)
for(i in 1:n.grid){
for(j in 1:n.grid){
mu.p[i,j] <- dnorm(muA.grid[i], 0, 1)*dnorm(muB.grid[j], 0, 0.5)
}
}
mu.p <-
2005 Sep 22
2
R: extracting elements in a matrix
Dear R-users
For a given matrix of dimension, say (n,p), I'd like to extract for every
column those elements that are bigger than twice the interquartile range of
the corresponding column.
Can I get these elements without using a loop?
Thank you for your help
Frank
[[alternative HTML version deleted]]
2007 Nov 15
2
how to extract the elements of a list of vectors in a fixed position?
Hi,
How is it possible to extract athe elements of a list of vectors in a fixed position? suppose that I have a list of 2-element vectors, how can I extract the 2nd element of all vectors in the list? Can it be done with indexing and not by element name?
Thanks
carol
So in this example, I want to extract 2 and 4
v = list (c(1,2), c(3, 4))
> v
[[1]]
[1] 1 2
[[2]]
[1] 3 4
2006 Oct 10
1
Extract p value from aov
Hi all,
In assessing the concordance of two sets of ANOVA results, I would like
to extract the p values from the summaries. I had a look at previous
answers to this problem, and the suggestions do not seem to work:
# toy example
test.df<-data.frame(subno=c(1:50,1:50),
ndrinks=c(rpois(50,4.5),rpois(50,4)),
b4after=c(rep(1,50),rep(-1,50)))
2007 Feb 05
3
Confidence intervals of quantiles
Can anyone please tell me if there is a function to calculate confidence
intervals for the results of the quantile function.
Some of my data is normally distributed but some is also a squewed
distribution or a capped normal distribution. Some of the data sets contain
about 700 values whereas others are smaller with about 100-150 values, so I
would like to see how the confidence intervals change
2007 Sep 03
1
match help
In my code, I would like to replace entries in t with
entries from a random normal distribution.
n<-10
> nl<-round(1.5+rexp(1,rate=2)
rate=2))
> nl
[1] 2
> r<-1:n
> s<-sort(sample(r,nl))
> t<-match(r,s)
> r
[1] 1 2 3 4 5 6 7 8 9 10
> s
[1] 3 8
>t
[1] NA NA 1 NA NA NA NA 2 NA NA
t.random<-function(x) {for(i in 1:n) ifelse(x[i]!=NA,
2006 Mar 10
3
Sweave scientific real display format (e.g. 5e-12)
Dear All,
I couldn't figure and couldn't google out how to make construct a pair of
\Sexpr s or a LaTeX macro that would include
5\cdot 10^{-12}
into the LaTeX output istead of
5e-12 .
Any ideas?
Thank you
G?bor