Agree, it is ambiguous. Will try again.... Suppose I have the following X<-matrix(c(1:20),nrow=4,byrow=T), hence this is a 4 by 5 matrix Y<-matrix(c(2,4,6,8),ncol=1), and this is a 4 by 1 vector, each value denote y1, y2,y3, y4 Step 1 - write each row of X as a vector, so I have vectors t(x_1), t(x_2), t(x_3) and t(x_4) Step 2 (inner product) ---- [prod(t(x_1) *x_2) + prod(t(x_1) *x_3) + prod(t(x_1) *x_4) ] *y1 Repeat for each row of X, that is [prod(t(x_2) *x_1) + prod(t(x_2) *x_3) + prod(t(x_2) *x_4)] *y2 [prod(t(x_3) *x_1) + prod(t(x_3) *x_2) + prod(t(x_3) *x_4)] *y3 [prod(t(x_4) *x_1) + prod(t(x_4) *x_2) + prod(t(x_4) *x_3)] *y4 Hope this makes better sense ...
> by the remaining j rows "remaining j rows" ==? What is "j", Is it nrow(X)-1 ? An what sort of "multiplication by rows" do you mean? The inner product? > multiplied by j y values (i.e sum( t(x_i) x_j y_j) ) "multiplied by j y values" ==? You defined Y but not y. Assuming that you meant Y values, then we are still left to speculate about which of the 5 Y values are suppose to be matched to the 3 rows of X. >>> David Winsemius <dwinsem...@comcast.net> 2009/04/03 04:24 AM >>> Generally unambiguous questions get answered quickly. Perhaps other readers are having the same difficulties I am experiencing. So let's try to parse what you are asking: On Apr 2, 2009, at 8:26 AM, Kutlwano Ramaboa wrote: > Hello > > This may have been answered elsewhere, and I have looked on the web, > but nothing helps. I am trying to do the following: > > X<-matrix(c(1:15),nrow=3,byrow=T) > Y<-matrix(c(2,4,6,8,10),ncol=1) > > I need to sum the product of each row of X "sum the product of each row" ==? sum( prod(x[i, ] * ? > by the remaining j rows "remaining j rows" ==? What is "j", Is it nrow(X)-1 ? An what sort of "multiplication by rows" do you mean? The inner product? > multiplied by j y values (i.e sum( t(x_i) x_j y_j) ) "multiplied by j y values" ==? You defined Y but not y. Assuming that you meant Y values, then we are still left to speculate about which of the 5 Y values are suppose to be matched to the 3 rows of X. > > > Hope this makes sense. Not to me. > > > Thanks in advance. > > Ps: how do I reference all the help that I have had from the R: team? ?citation > > > [[alternative HTML version deleted]] David Winsemius, MD Heritage Laboratories West Hartford, CT ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.