[R] matrix multiplication question

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 18 07:00:58 CEST 2008


On 17/07/2008 9:47 PM, Murali K wrote:
> Hello,
>         I am a newcomer to R and therefore apologize for posting such a
> basic question. I am
> trying to multiply 2 matrices t(X1)%*%X1, where t(X1) is:

It's hard to say for sure, but it looks as though X1 really isn't a 
numeric matrix.  The "ones" and "Shadow" entries on the left look like 
character or factor data.

To find out what X1 is, you can run str(X1).

Duncan Murdoch
> 
> 
>             1 2  3  4  5 8 12 13 20 24  26 27  31 33 34 36 37 40 41 42 45 46
> 47 48 49
> ones     1  1 1  1  1 1  1  1  1   1    1  1     1  1  1  1   1   1   1   1
> 1   1   1   1   1
> Shadow 0 1 1  1   1 1  1  1  0   1    1  1     1  0  1  0   1   0   1   1
> 0   1   0   1   0
> 
> However, when I try to perform this operation, I obtain:
> Error in t(X1) %*% X1 : requires numeric matrix/vector arguments
> 
> Can someone please tell me what I seem to be doing wrong? thanks.
> 
> Sincerely,
> Murali Kuchibhotla
> 
> 
> Murali Kuchibhotla
> Department of Economics
> Iowa State University
> Office:75,Heady
> Phone:515-294-5452
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list