# Re: st: matching created matrix and the original data set

 From Mandy fu To statalist@hsphsun2.harvard.edu Subject Re: st: matching created matrix and the original data set Date Tue, 18 Aug 2009 13:09:47 -0400

```Hi all,

Regarding  this question, I am thinking perhaps it is easier to not
come back to the original data set. For instance , if using --xsvmat--
convert the created matrix into a new data set, which only includes
women, I can do the t test there.
I will appreciate if you could give me some suggestion. Thanks!
Mandy

On 8/18/09, Mandy fu <mandy.fu1@gmail.com> wrote:
> Hi all,
>
> It would be great if you could give me some suggestion on the
> following question about matrix operation for a survey data set.
>
> The data set includes respondents of  male (2517 obs)and female(2480
> obs).First I run  earnings function for male and female separately.
> Then I want to do a t test for comparing the group mean of (sum of
> Bmale*X'female) and (sum of Bfemale*X'female). The former means the
> earnings of a female when she is treated the same as a male with
> identical endowment in labor market. The  latter means the predicted
> value of how much a female earns.,
>
> where Bmale:   the coefficients get for a regression for each male
>           Bfemale: the coefficients get for a regression for each female
>           Xmale:    the original values of independent variables for each male
>           Xfemale: the original values of independent variables for each female
>
> From matrix calculation, I have get two matrices( each has 2480 rows
> and 1 column ) that each row presents each female in the data set. But
> in order to do the t-test , I need to take the probability weight into
> consideration.
>
> I am thinking maybe I could use one of the following way  to do this:
> (1) During matrix calculation, I include the probability weight as an
> additional column. So, I can do the t-test without coming back to the
> original data set.
> (2)After matrix calculation, I convert the results into variables for
> each female and add the new variables to the original data set. Then
> do the t test in the original data set.
>
> As to (2),  I am not sure using --svmat--how to make sure the new
> variables converted from matrices match the ID numbers in the original
> data set(each matrix is only for female, but the data set includes
> male and female). Could I expand the matrix by adding zero rows for
> male before converting variables? And I am not sure which one of the
> two ways  is easier.
>
> If there is anything I need to clarify, please let me know. Thanks for