search for: nrow2

Displaying 2 results from an estimated 2 matches for "nrow2".

Did you mean: nrow
2003 Oct 31
2
Summing elements in a list
...s the weighted sum of the corresponding matrices. I could use a loop but this is a nested calculation so I was hoping there is a more efficient way to do this. To help clarify, here is the code I would use with a for loop result <- list(mat1=matrix(0,nrow1,ncol1), mat2=matrix(0,nrow2,ncol2)) for (i in seq(along=matlist)) { result$mat1 <- result$mat1+w[i]*matlist[[i]]$mat1 result$mat2 <- result$mat2+w[i]*matlist[[i]]$mat2 } I apologise if this is a trivial question. Unfortunately I don't have my copy of V&R S Programming to hand. Thanks for your help, Ange...
2012 Oct 10
2
lm on matrix data
Hi, I have a question about using lm on matrix, have to admit it is very trivial but I just couldn't find the answer after searched the mailing list and other online tutorial. It would be great if you could help. I have a matrix "trainx" of 492(rows) by 220(columns) that is my x, and trainy is 492 by 1. Also, I have the newdata testx which is 240 (rows) by 220 (columns). Here is