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

From |
"Ronnie Babigumira" <ronnie.babigumira@ios.nlh.no> |

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

Subject |
st: RE: RE: Filling upper triangle of a symetric matrix |

Date |
Wed, 26 Mar 2003 17:31:16 +0100 |

Thanks Nick Works like a charm (can it be generalized for similar problems or is it not worth the extra bit) Ronnie Ronnie wrote > (Stata 8, win 2K) I have a correlation matrix in excel (I > dont have the data > from which it was obtained) and I would like to perform > factor analysis on > this matrix. This is possible if by using corr2data, I generate the > underlying data and then I can perform the factor analysis. > > Here is my correlation matrix > Corr Matrix > 1 > 0.439 1 > 0.41 0.351 1 > 0.288 0.354 0.164 1 > 0.329 0.32 0.19 0.595 1 > 0.248 0.329 0.181 0.47 0.464 1 > > If I try to read this in stata (using insheet), I get 6 new > variables with > missing cases > > +---------------------------------------+ > | v1 v2 v3 v4 v5 v6 | > |---------------------------------------| > | 1 . . . . . | > | .439 1 . . . . | > | .41 .351 1 . . . | > | .288 .354 .164 1 . . | > | .329 .32 .19 .595 1 . | > |---------------------------------------| > | .248 .329 .181 .47 .464 1 | > +---------------------------------------+ > I then convert this into a matrix using mkmat and I get > > a[6,6] > 1 . . . . . > .43900001 1 . . . . > .41 .35100001 1 . . . > .28799999 .354 .164 1 . . > .329 .31999999 .19 .59500003 1 . > .248 .329 .18099999 .47 .46399999 1 > > Question. How can I tell stata that this is a symetric > matrix and fill in > the missing ijs with the corresponding ji values? (or, how > can I do this in > excel) forval i = 1/6 { forval j = 1 / 6 { if a[`i',`j'] == . matrix a[`i',`j'] = a[`j',`i'] } } Nick n.j.cox@durham.ac.uk * * 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: RE: RE: RE: Filling upper triangle of a symetric matrix***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: RE: Filling upper triangle of a symetric matrix***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: Text editors and Stata FAQ** - Next by Date:
**Re: st: outreg in max likelihood estimation** - Previous by thread:
**st: RE: Filling upper triangle of a symetric matrix** - Next by thread:
**st: RE: RE: RE: Filling upper triangle of a symetric matrix** - Index(es):

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