Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: AW: vce matrix manipulation before and after pca


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: vce matrix manipulation before and after pca
Date   Fri, 6 Aug 2010 09:44:42 +0200

<> 

Technically, you can do it like this, but I am not sure whether the result
is meaningful in any way:

*************
sysuse auto, clear
pca trunk weight length headroom if foreign, vce(normal)
mat A=e(V)
pca trunk weight length headroom if !foreign, vce(normal)
mat B=e(V)
mat C=(A+B)/2
mat l C
*************


Where did you get the idea to use "__000001"? These are temporary objects
which you cannot access the way you tried to...


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Sheela Athreya
Gesendet: Freitag, 6. August 2010 03:34
An: statalist@hsphsun2.harvard.edu
Betreff: st: vce matrix manipulation before and after pca

I am trying to do the following in StataSE 11.1 for the Mac (OS 10.6) using
a dataset comprised of 23 continuous variables (measurements of the
skeleton) on 11,000 modern humans--a mixed sample of adult males and
females.

1) Do a PCA of the males and females separately (I used the operation: "by
SEX_CODED, sort : pca GOL-OAA")

2) Average the resulting vce matrices together

My question is:  how do I save the two vce matrices that are computed from
these two pca's (one on each sex) and average them together to form one
pooled-sex vce matrix? I don't know Mata so my question is related to doing
this in Stata SE 11.1.

-I tried this using the command "matrix define ModPooledSex =
__000001+__000000/2"--in other words, the two resulting matrices that were
in memory, I added together and tried to divide by 2.   I got the error
"000000 not found", even though that was one of the matrix names available
in the pull-down menu under "define matrix from expression"--presumably it
was one of two matrices automatically stored in memory.

When I tried to do the same thing again, I only saw one matrix (named
000000) in memory.  I am able to view that matrix, but not save or
manipulate it at all.  

I have tried "estimates store", but can't retrieve the actual vce matrix to
manipulate it or use it in other analyses.

My next question is: how can I then use a user-defined vce matrix (the
pooled-sex one) and take another dataset entirely (of the same measurements,
but different individuals, called Dataset2) and compute PC scores for
Dataset2 based on the pooled-sex vce matrix from the modern human dataset?

I hope this isn't too confusing, or too basic.  I've been rooting around in
all the documentation, the statalist archives, etc for hours before posting
to the list, but I truly just can't figure it out.  Any help would be
greatly appreciated.

Many thanks,

*******************************
Sheela Athreya, Ph.D.
Department of Anthropology
Texas A&M University
College Station, TX  77843



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index