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]

From |
Christopher Baum <[email protected]> |

To |
"[email protected]" <[email protected]> |

Subject |
re: st: loop |

Date |
Thu, 29 Mar 2012 11:24:39 -0400 |

<> 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/

**Follow-Ups**:**Re: st: loop***From:*Chiara Mussida <[email protected]>

- Prev by Date:
**Re: st: Mlogit with fixed effects** - Next by Date:
**Re: st: Tolerance for -merge- variable** - Previous by thread:
**Re: st: loop** - Next by thread:
**Re: st: loop** - Index(es):