[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: -gen double- or -gen-

Subject   Re: st: -gen double- or -gen-
Date   Mon, 16 Mar 2009 10:57:54 -0400

Thanks Maarten,

I know what's "double" now.

And I have to corrected my expression in the previous email.

I first use -gen-...  to calculate the elements of matrix M.

Then -mkmat h*, mat(M)- creat matrix M as T*10, where T is the mumver of observations in the sample and there are 10 elements in the lower triangle of the matrix for a specific period

Now I want to calculate the eigenvalues of the matrix for each time period:

M = st_matrix("M")
lambda = J(cols(M), 4, .)
for(t=1; t<=cols(M); t++) {
mt = invvech(M[., t])
lambda[t, .] = symeigenvalues(mt)

I am wondering if -M= = st_matrix("M")- here make sure it is a *symmetric* matrix with the elements h11 h21... that I just generated.

Quoting Maarten buis <>:

--- On Mon, 16/3/09, wrote:
I am trying to make a *symmetic* matrix M like:

h21  h22
h31  h32  h33
h41  h42  h43  h44

The codes:

gen double??? h11
gen double??? h21
gen double??? h31
gen double??? h41
gen double??? h22
gen double??? h32
gen double??? h42
gen double??? h33
gen double??? h43
gen double??? h44

mkmat h*, mat(M)

What's the difference with and without -double-?

If your aim is to create a symetric matrix, you
should not use -gen- anyhow. For more on how to
create a matrix see: -help matrix define-.

Hope this helps,

Ps. the difference between -gen- and -gen double-
is explained in -help data types-

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

*   For searches and help try:

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