Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: -hhset- hrespnr?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: -hhset- hrespnr?
Date   Fri, 7 Mar 2008 20:18:53 -0000

Your real problem is emerging only very gradually! 

I am signing off shortly and will not be accessing Statalist for a day
or two 
but others may be minded to help. 

Your data as I understand it consist (in part) of pairs of observations:


Husband in couple 1               
Wife in couple 1 

Husband in couple 2
Wife in couple 2 

And so forth. 

Now: what do you want? 

1. To reshape, so that each couple becomes a single observation. 

2. To put values for the husband in the wife's observation and vice
versa. 

3. Something else. 

Code like that below 

... ageofwife=age if wife==1
.. ageofhusband=age if husband==1

will _not_ do either 1. Or 2. 

Remember: Jeroen Weesie's original article is accessible via 

http://www.stata.com/products/stb/journals/stb43.pdf

Nick
[email protected] 

Nirina F

Dear Nick,

Thank you for taking the time to respond.  I understand what you mean
but

actually, what I meant was that  if I run

"reg income ageofwife ageofhusband schoolingofwife schoolingofhusband "

it gives me 0 observation because of how the explanatory variables
were generated:

 ageofwife=age if wife==1
ageofhusband=age if husband==1

then used together ends up in intersection and here comes my problem.

Nirina



On 3/7/08, Nick Cox <[email protected]> wrote:
> Unless I am looking at another typo, you have it the wrong way around.
>
> ... if husband == 1 & wife == 1
>
> checks whether a particular person is _both_ husband _and_ wife.
> From your definitions, or otherwise, it is clear that can't happen,
> so as you say no observations turn out to be selected.
>
> You want
>
> ... if husband == 1 | wife == 1
>
> Otherwise put, | gives you unions, & gives you intersections.
>
> Nick
> [email protected]
>
> Nirina F
>
> Dear Nick,
> Also,  husband's age, wife's age etc... were created using if wife==1&
> husband==1, so even if I don't use the constraint "if wife==1&
> husband==1", I get 0 observation.
> I am stuck with my definition.
>
> On 3/7/08, Nirina F <[email protected]> wrote:
> > I am sorry Nick, I meant sex==0 is male and I had it correct in my
do
> > file but somehow  I had it 1 here.
> > So after I generate these and then run reg with if wife==1 &
> > husband==1, I get 0 observation because the union of the two is
zero.
> >
> >
> > On 3/6/08, Nick Cox <[email protected]> wrote:
> > > It seems that you have data on individuals, some male, some
female;
> > > some husbands, some wives, some other categories.
> > >
> > > Your definitions are
> > >
> > > gen wife = ms == 2 & sex == 1 & head == 2
> > >
> > > gen husband = ms == 2 & sex == 1 & head == 1
> > >
> > > I assume here heterosexual marriages. Hence a husband must
> > > be male. So sex == 1 is wrong to define husbands if, as you say,
> > > that designates females.
> > >
> > > Nick
> > > [email protected]
> > >
> > > Nirina F
> > >
> > > Dear Nick,
> > > I looked at what you put together on Stata faqs
> > > http://stata.com/support/faqs/data/members.html
> > > so could you may be help me in this.
> > > I have one dataset so I don't need to merge but to separate
members
> of
> > > household out but then be able to run a
> > > reg income ageofwife ageofhusband schoolingofwife fe
> > > This is how I defined
> > >
> > > gen wife=0
> > > replace wife=1 if  ms==2 & sex==1 & head==2
> > >
> > > [ms is marital status, taking value 2 if married
> > > sex is gender, taking value 1 if female
> > > head is the relationship to hh head, taking value 2 if wife]
> > >
> > > gen husband=0
> > > replace husband=1 if  ms==2 & sex==1 & head==1
> > >
> > > I have one dataset so I don't need to merge but to separate
members
> of
> > > household out but then be able to run an equation like:
> > >
> > > reg income ageofwife ageofhusband schoolingofwife
schoolingofhusband
> > >
> > > I know something is wrong with my definition above because I get 0
> > > observation when I run the regression.
>

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index