[R] solve matrix
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Sun Apr 16 13:45:37 CEST 2006
Nongluck Klibbua <Nongluck.Klibbua at newcastle.edu.au> writes:
> Hi R-users,
> I try to use "solve" to find the answer of this linear equation
> a=x*b where a is 2*1 matrix and b is 2*2 matrix.I would like to get x so
> I call y<-solve(a,b) but this one happen "a is 2*1 matrix" so what I should do .
> Thanks
> Luck
>
First get your extents right. For the matrix product x*b to make
sense, you need x to be n*2 if b is 2*2, and the result is n*2, so how
can a be 2*1??
Next, notice that solve(A,b) solves A*x = b, where A is a square
matrix, so you need solve(b,a) or maybe solve(b, t(a)) or
t(solve(b,t(a)) depending on what your problem really was.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list