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

From |
"R.E. De Hoyos" <redeho@hotmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: RE: Re: RE: Re: RE: summing up matrix elements |

Date |
Tue, 8 Nov 2005 18:49:47 -0000 |

Nick,

Thanks for advice and the references. Rafa

----- Original Message ----- From: "Nick Cox" <n.j.cox@durham.ac.uk>

To: <statalist@hsphsun2.harvard.edu>

Sent: Tuesday, November 08, 2005 6:24 PM

Subject: st: RE: Re: RE: Re: RE: summing up matrix elements

OK. Jamie's solution is still presumably better

in Stata 8. When Jeroen and then I wrote

some crude matrix add-ons in 1997-2000,

-vec()- had not been implemented, I believe.

STB-56 dm79 . . . . . . . . . . . . . . . . . . Yet more new matrix commands

(help matcorr, matewmf, matvsort, svmat2 if installed) . . N. J. Cox

7/00 pp.4--8; STB Reprints Vol 10, pp.17--23

commands to produce a correlation matrix, elementwise monadic

function of another matrix, selected subsets of matrix rows

and columns, vec or vech of a matrix, elements sorted within

a vector, matrix from a vector, and commands to save matrices

STB-50 dm69 . . . . . . . . . . . . . . . . . . Further new matrix commands

(help matdelrc, matewm, matmad, matpow if installed) . . . N. J. Cox

7/99 pp.5--9; STB Reprints Vol 9, pp.29--34

collection of new matrix commands providing additional matrix

checking, management, element-wise operators, maximum absolute

difference, and power

STB-39 dm49 . . . . . . . . . . . . . . . . . . . . Some new matrix commands

(help matfunc, varfunc if installed) . . . . . . . . . . . J. Weesie

9/97 pp.17--20; STB Reprints Vol 7, pp.43--48

collection of new matrix commands; several for explicit matrices

and a few for implicit matrices (i.e., variables)

Nick

n.j.cox@durham.ac.uk

-----Original Message-----

From: owner-statalist@hsphsun2.harvard.edu

[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of

R.E. De Hoyos

Sent: 08 November 2005 18:15

To: statalist@hsphsun2.harvard.edu

Subject: st: Re: RE: Re: RE: summing up matrix elements

> Offhand, I can't think of any reason why anyone

> with Stata 9 would prefer that. Nor, I imagine,

> would Jeroen if he were to be asked.

I have access to Stata 9 only when I am in the University, in

my laptop I

have version 8.

Rafa

----- Original Message ----- From: "Nick Cox" <n.j.cox@durham.ac.uk>

To: <statalist@hsphsun2.harvard.edu>

Sent: Tuesday, November 08, 2005 5:59 PM

Subject: st: RE: Re: RE: summing up matrix elements

> You may be thinking of Jeroen Weesie's -matsum-.

> Offhand, I can't think of any reason why anyone

> with Stata 9 would prefer that. Nor, I imagine,

> would Jeroen if he were to be asked.

>

> STB-39 dm49 . . . . . . . . . . . . . . . . . . . . Some

new matrix

> commands

> (help matfunc, varfunc if installed) . . . . . . .

. . . . J.

> Weesie

> 9/97 pp.17--20; STB Reprints Vol 7, pp.43--48

> collection of new matrix commands; several for

explicit matrices

> and a few for implicit matrices (i.e., variables)

>

> Nick

> n.j.cox@durham.ac.uk

>

> R.E. De Hoyos

>

>> Both your solutions work fine, thanks a lot.

>> I though there was a non-mata matrix function similar to

>> mata's -sum(C)-

>

> Nick Cox

>

> . mata : sum_r = (sum(C) - trace(C)) / 2

>

> R.E. De Hoyos

>

>> >> > Is there a way to to get a scalar containing the sum of the

>> >> > off-diagonal

>> >> > elements of a pre-defined matrix?

>> >> >

>> >> > For instance, define matrix C as a correlation matrix. I

>> >> > want to know what

>> >> > is the sum of correlations between the various elements in C.

>> >> > Therefore I

>> >> > need the sum of all elements in C minus the sum of the

>> >> > diagonal elements

>> >> > (-trace(C)-) and finally divide it by 2 (I am assuming

>> matric C is

>> >> > symetric).

* * 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/

* * 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/

**Follow-Ups**:**st: Looping and replacing embedded text***From:*"Joe Crespo" <joe.crespo@hotmail.com>

**st: creating an array with hospitalization days***From:*"Maria Montez" <montez@bu.edu>

**References**:**st: RE: Re: RE: Re: RE: summing up matrix elements***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: Re: RE: Re: RE: summing up matrix elements** - Next by Date:
**st: creating an array with hospitalization days** - Previous by thread:
**st: RE: Re: RE: Re: RE: summing up matrix elements** - Next by thread:
**st: creating an array with hospitalization days** - Index(es):

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