Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Mata: Calculating conditional expectation


From   <[email protected]>
To   <[email protected]>
Subject   st: Mata: Calculating conditional expectation
Date   Tue, 23 Apr 2013 09:45:58 +0100

As the Statalist FAQ enjoins you, please use full references when citing
work. (For unpublished work, it's especially useful to include URLs to
the relevant paper.) How else are readers supposed to know what you are
referring to? Statalist has a very multidisciplinary membership.    It
was only with multiple minutes Googling that I discover that the paper
that I think you are referring to may be the one found at
http://home.uchicago.edu/~mittag/papers/BCM.pdf

Stephen
------------------
Stephen P. Jenkins <[email protected]>

------------------------------

Date: Tue, 23 Apr 2013 11:45:51 +0800
From: Ivan Png <[email protected]>
Subject: st: Mata: Calculating conditional expectation

Many thanks to Statalist members for their previous help on
constructing the matrix.

To recall, my dependent variable is categorical: Mobility = 1 if
inventor changed employer, else = 0.  I'm investigating the effect of
classification error.  Obviously, this cannot be classical.  Let Y =
true mobility and Z = recorded mobility. If Y = 0 and Z = 1, then
error = -1, while if Y = 1 and Z = 0, error = +1.

Meyer and Mittag, U of Chicago (2012) characterize the bias as
N(X'X)^{-1} [ Pr( Y = 0 & Z = 1) E(X :  Y = 0 & Z = 1) - Pr(Y = 1 & Z
= 0) E(X :  Y = 1 & Z = 0) ].  I have a benchmark data set with both
the true and inaccurate mobility data, and would like to compute the
bias.

So, I need to compute the conditional expectations, E(X :  Y = 0 & Z =
1) and E(X :  Y = 1 & Z = 0), and then weight by the probabilities,
take the difference, and pre-multiply by N(X'X)^{-1}.  My idea:

. keep if Y = 0 & Z = 1
. mata : F = mean(X)
. mata : mata matsave filename

and repeat for Y = 1 & Z = 0.

But, sadly, I don't how to proceed.  How to combine the original data
with the two new files containing the conditional expectations, and
then going back to MATA to calculate the bias.  Grateful to
Statalisters for help.

- -- 
Best wishes
Ivan Png
Skype: ipng00
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

========================

Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index