# st: Re: RE: Regression and "what-if" predictions

 From "Christer Thrane" To Subject st: Re: RE: Regression and "what-if" predictions Date Tue, 29 Aug 2006 22:02:27 +0200

The problem with the automatic procedures is that they are designed for (repeated) cross-sectional models, and not for panel regression models.

As regards the manual sollution, do you mean somthing like:

1.

use wagedata ...
drop if male==0
drop male

collapse (mean) edyears exp expsq nrchild (max) married year

save wagedata_men ...

This generates the married male in year 2002 with average values on the remaining variables.

2.

use wagedata ...

xtreg logwage edyears exp expsq married if male==0, re cluster(lpnr)

This is the wage model for women.

3.

use wagedata_men ...

predict lwhat

list lwhat

This gets me the logwage for a married male in year 2002 with average values on the remaining variables given the women's regression coefficients???

Am I on to something here?

BR

Christer

************************************************
Professor Christer Thrane
Department of Social Science
Lillehammer University College
2626 Lillehammer, Norway
+ 47 61 28 81 70 (fax)
+ 47 61 28 82 47 (phone, work)
+ 47 61 25 53 04 (phone, home)
E-mail, work: christer.thrane@hil.no
E-mail, home: ch-thran@online.no
************************************************

----- Original Message ----- From: "Steve Stillman" <stillman@motu.org.nz>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, August 29, 2006 9:05 AM
Subject: st: RE: Regression and "what-if" predictions

Hi Christine.

The problem you are running into is that adjust isn't really designed to do something as complicated as you are trying to do.

There are a number of user written commands that automate the process of doing wage decompositions. It is likely that one of these does what you are looking for - try findit "smithwelch", "jmp" , "oaxaca", "decompose", "jmp2".

The other option is to use predict to do this by hand. one great feature of predict is that you can change datasets and still make predictions based on the last estimated model. So, all you need to do is set up a fake dataset (or add these as extra observations to your current dataset) with the values of the X variables that you want to use in your predictions and then run the appropriate regression model, change datasets, and use predict to create the appropriate fitted values.

Hope this helps.

Cheers,
Steve

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Christer
Thrane
Sent: Saturday, August 26, 2006 4:02 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Regression and "what-if" predictions

Hi,

The variables in my panel regression model are:

logwage (log of annual wage)
male (male=1, female=0)
edlevel (5 levels of education)
exp (working experience)
expsq (working experience squared)
year (1994=0, 1995=1, ... 2002=8)
married (married=1, unmarried=0)
nrchild (number of children)

The first prediction I'm interested in is the:

(i) log wage for a married male with edlevel = 3 in 2002 with average number
of children and working experience.

To obtain this, I use the code:

xi: xtreg logwage i.edlevel exp expsq year /*

```*/ married nrchild if male==1, re cluster (lpnr)
```
```and

adjust _Iedlevel_2=0 _Iedlevel_3=1 _Iedlevel_4=0 _Iedlevel_5=0 /*
```
```*/ exp expsq year=8 married=1 nrchild if male==1
```
This seems to work well.

The second prediction I'm interested is analogues to (i), but now I want to
answer the question, What would be "the same" male's logwage if he had
female averages on the various independent variables in the model?

To obtain this second prediction (ii), I simply replace the "male==1" with
"male==0" in the -adjust- command, as in:

adjust _Iedlevel_2=0 _Iedlevel_3=1 _Iedlevel_4=0 _Iedlevel_5=0 /*

```*/ exp expsq year=8 married=1 nrchild if male==0
```
This also seem to work well. At least exp, expsq and nrchild are given the
female's averages, but I'm not sure of whether the effect of married and
year are evaluated at the female's averages here.

Now comes the tricky part, i.e. the two predictions I don't know how to get:

(iii) What would "the same" male's logwage if he had male averages on the
various independent variables, but the female's xt regression coefficients?

(iv) What would "the same" male's logwage if he had female averages on the
various independent variables, but the female's xt regression coefficients?

At some point this, I think, involves the regression:

xi: xtreg logwage i.edlevel exp expsq year /*

```*/ married nrchild if male==0, re cluster (lpnr)
```
```to obtain the female's xt regression coefficients, but I can't seem to
figure out how to "force" the female's coefficients onto the male sample.
Any help is appreciated!

Best regards,

Christer Thrane
Lillehammer University College

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```