[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

# RE: st: triangular matrices

 From Brendan Halpin <[email protected]> To [email protected] Subject RE: st: triangular matrices Date Fri, 17 Nov 2006 11:03:04 +0000

```Kit Baum replies:
> In response to Brendan's desire to generate a Stata matrix from its
> lower triangle: if this is meant to be a 4x4 matrix, what is on the
> diagonal? I have put zeroes on the diagonal:

That's correct, it's a dissimilarity matrix.

> clear
> input v1 v2 v3
> 1 1 0
> 1 2 12
> 1 3 13
> 1 4 14
> 2 2 0
> 2 3 23
> 2 4 24
> 3 3 0
> 3 4 34
> 4 4 0
> end
> mkmat v3,mat(a)
> mata: st_matrix("b",invvech(st_matrix("a")))
> mat list b

Thanks for that solution -- it points me towards Mata which I had
been studiously ignoring.

Unfortunately, if I understand things correctly, this introduces a
size limitation: for an m*m dissimilarity matrix, the "mkmat
v3,mat(a)" statement will create an m*(m-1)/2 vector. If I want m
to run up close to the "set matsize" limit, this is not possible.
(My understanding might be wrong: if I say "set matsize 100" I can
create 100*100 matrices but not 101*1 vectors?).

Brendan
--
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:[email protected]  http://www.ul.ie/sociology/brendan.halpin.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```

 © Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index