Re: [R] Problem on Matrix multiplication

From: Daniel Nordlund <res90sx5_at_verizon.net>
Date: Thu 15 Jun 2006 - 16:58:32 EST


It looks like weight and s are data frames, not vectors/matrices as required (and as the error message tells you).

Dan

Daniel Nordlund
Bothell, WA

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch [mailto:r-help-bounces@stat.math.ethz.ch]
> On Behalf Of Arun Kumar Saha
> Sent: Wednesday, June 14, 2006 11:10 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Problem on Matrix multiplication
>
> Dear all r-users,
>
> I am getting a big problem with matrix multiplication
>
> suppose I have,
>
> > weight
> Weight
> 1 1067640
> 2 8871500
> 3 42948778
> 4 127583735
> 5 22000000
> 6 44000000
> 7 56850000
> 8 23805662
>
> and,
> > s
> a b c d e
> f g h
> a 402493.18 -133931.62 461483.3 -94042.86 674493.8 -1493713.2 -
> 714081.5 -1320551.6
> b -133931.62 192766.63 -414674.4 -36700.74 -276595.3 798034.6
> 382661.6 883478.4
> c 461483.25 -414674.43 1618660.4 660949.18 988526.5 -2795048.7 -
> 1483334.1 -1761234.9
> d -94042.86 -36700.74 660949.2 1053310.43 -300291.4 -98814.9 -
> 263716.7 1130451.3
> e 674493.80 -276595.33 988526.5 -300291.35 3090869.8 -3017747.3 -
> 1766040.6 -2295605.0
> f -1493713.19 798034.60 -2795048.7 -98814.90 -3017747.3 10558734.1
> 4415620.8 6200897.7
> g -714081.51 382661.62 -1483334.1 -263716.67 -1766040.6 4415620.8
> 2593947.5 2341455.0
> h -1320551.58 883478.39 -1761234.9 1130451.26 -2295605.0 6200897.7
> 2341455.0 7756557.3
>
>
> But when I want to get [transpose(weight)][s][weight] using following
> syntax,
>
> t(weight)%*%s%*%weight
>
>
> I got error:
>
> Error in t(weight) %*% s %*% weight : requires numeric matrix/vector
> arguments
>
> Can anyone please tell me that where my error is?
>
> Thanks and regards,
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 15 17:13:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 15 Jun 2006 - 20:12:20 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.