On Nov 16, 2012, at 8:34 AM, frespider wrote:
> Hi
>
> Can someone show me an easy way to multiple a weighted vector with an
> matrix?
>
> example below
> mat1<-matrix(sample(1:100,80,replace=TRUE),ncol=8)
> w <- 1/1:10
>
> I want the first element in w to be multiplied by the first row of mat
ent: Friday, November 16, 2012 2:45 PM
Subject: Re: [R] Multiple Vector with matrix in R
Hello,
Try the following.
t(sapply(seq_along(w), function(i) mat1[i,]*w[i]))
Hope this helps,
Rui Barradas
Em 16-11-2012 16:34, frespider escreveu:
> Hi
>
> Can someone show me an easy way to multip
Hello,
Try the following.
t(sapply(seq_along(w), function(i) mat1[i,]*w[i]))
Hope this helps,
Rui Barradas
Em 16-11-2012 16:34, frespider escreveu:
Hi
Can someone show me an easy way to multiple a weighted vector with an
matrix?
example below
mat1<-matrix(sample(1:100,80,replace=TRUE),ncol=
Hi
No i didn't get error it executed too fast, I had question about the Sum
squares in the weighted least square if u can help me I would I appreciated
Thanks
Date: Fri, 16 Nov 2012 09:46:59 -0800
From: ml-node+s789695n4649775...@n4.nabble.com
To: frespi...@hotmail.com
Subject: Re: Multiple
Hi A.K
Here is the error I get when I use %*%
> dim(X)
[1] 71142 219
> length(Weights)
[1] 71142
> Wx<-diag(Weights)%*%X
Error in array(0, c(n, p)) : 'dim' specifies too large an array
That is why I asked for different and faster method
--
View this message in context:
http://r.789695.n4.na
5 matches
Mail list logo