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]

Re: st: loop


From   Chiara Mussida <cmussida@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: loop
Date   Fri, 30 Mar 2012 11:05:28 +0200

margins, by(fem occupation)
gives me all the values of the interactions between fem#occupation,
therefore a total of 14 interactions (2 genders*7 occupations):

--------------------------------------------------------------------------------
               |            Delta-method
               |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
fem#occupation |
          0 1  |   2.398703   .0055137   435.04   0.000     2.387896     2.40951
          0 2  |   2.122676   .0037042   573.04   0.000     2.115416    2.129936
          0 3  |   1.991713   .0042913   464.13   0.000     1.983303    2.000124
          0 4  |   1.870097   .0044309   422.06   0.000     1.861413    1.878781
          0 5  |    1.84829    .003824   483.34   0.000     1.840795    1.855785
          0 6  |   1.906402   .0049577   384.53   0.000     1.896685    1.916119
          0 7  |   1.729511   .0051132   338.24   0.000     1.719489    1.739532
          1 1  |   2.416612   .0055682   434.00   0.000     2.405698    2.427525
          1 2  |   2.176147   .0036372   598.31   0.000     2.169018    2.183276
          1 3  |   2.007075   .0042586   471.30   0.000     1.998728    2.015422
          1 4  |   1.838439   .0044087   417.00   0.000     1.829798     1.84708
          1 5  |   1.862418   .0039549   470.92   0.000     1.854666    1.870169
          1 6  |   1.921239   .0050201   382.71   0.000       1.9114    1.931078
          1 7  |   1.750215   .0051475   340.01   0.000     1.740127    1.760304
--------------------------------------------------------------------------------

is it possible to gen a new variable for each of the listet interaction?
For example, a variable taking the value 2.398703, etc. This is useful
for me, since therafter I have to compute calculations by using these
interactions.

thanks
Chiara





On 30/03/2012, Chiara Mussida <cmussida@gmail.com> wrote:
> Thanks Kit,
>
> margins, by(married occupation)
> gives me the product between the Betas of the estimated wage reg and
> the mean value of characteristics for each occupation, for married and
> unmarried. Right?
>
> Chiara
>
> On 29/03/2012, Christopher Baum <kit.baum@bc.edu> wrote:
>> <>
>> Chiara said
>> I wrote a loop for wage regressions to obtain the predicted wages if
>> men are paid as men at each occupation:
>>
>> reg lwage $x if fem==0
>> predict pip if fem==0, xb
>> forvalues k = 1 2 to 7 {
>> 	predict pip`k' if fem==0 & occ`k'==1, xb
>> }
>> summarize pip, meanonly
>> scalar xMbM=r(mean) /*Predicted wages if men are paid as men*/
>> forvalues k = 1 2 to 7 {
>> 	summarize pip`k', meanonly
>> 	scalar xMbM`k'=r(mean) /*Predicted wages if men are paid as men at
>> each occupation*/
>> }
>>
>> I now want to get the xMbM (and also xFbF for females) by occupation.
>> For each occupation I want the product between ythe mean individual
>> charachteristics (xM) and the coefficients (bM). I tried with this
>> loop, but i'm not sure it's the correct one:
>>
>> reg lwage $x if fem==0
>> predict pip if occupation==1, xb
>> forvalues k = 1  {
>> 	predict pip`k' if fem==0 & occ`k'==1, xb
>> }
>> summarize pip, meanonly
>> scalar xMbM=r(mean) /*Predicted wages if men are paid as men*/
>> forvalues k = 1 {
>> 	summarize pip`k', meanonly
>> 	scalar xMbM`k'=r(mean) /*Predicted wages if men are paid as men at
>> each occupation*/
>> }
>>
>> More precisely, i'm not sure this wille give me each product between
>> mean values of characteristics (x, for M or F) and estomated wage
>> equation coefficients (b, for M or F) at each 1...7 occupation.
>>
>>
>>
>>
>> No need for all this manual labor...
>>
>> --------------------
>> webuse nlsw88,clear
>> // lets treat marital status as equivalent of gender, since all people
>> here
>> are women
>> // run regression over all cases so can generate pred wage by mar.stat.
>> and
>> occup.
>> reg wage age collgrad south i.occupation
>> margins, by(married occupation)
>> marginsplot,graph(married) xlab(,angle(90))
>> ---------------------
>>
>> Kit
>>
>>
>> Kit Baum   |   Boston College Economics & DIW Berlin   |
>> http://ideas.repec.org/e/pba1.html
>>                              An Introduction to Stata Programming  |
>> http://www.stata-press.com/books/isp.html
>>   An Introduction to Modern Econometrics Using Stata  |
>> http://www.stata-press.com/books/imeus.html
>>
>>
>> *
>> *   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/
>>
>
>
> --
> Chiara Mussida
> PhD candidate
> Doctoral school of Economic Policy
> Catholic University, Piacenza (Italy)
>


-- 
Chiara Mussida
PhD candidate
Doctoral school of Economic Policy
Catholic University, Piacenza (Italy)
*
*   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