Author Topic: HW2 Q2c  (Read 620 times)

mmorkous

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
HW2 Q2c
« on: February 21, 2017, 04:45:41 PM »
For 2c,


I tried doing:


gen x=1
replace x=0 if wage>0 lfp=1 hours>0 to see if the function is true but it's saying invalid lfp. If I tried without lfp, it says invalid hours and so on. I know the function is true by manually looking at the three variables using browse. Any idea?
Thanks!


Roric Brown

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 43
    • View Profile
Re: HW2 Q2c
« Reply #1 on: February 21, 2017, 05:09:34 PM »
If that line beginning with "replace x=0..." is directly from your code, STATA will not recognize lfp and hours without including either an '&' or an '|' in your code.  I'm not sure exactly what you're asking, but this might just be a problem with your code.


& translate to and
| translates to or.


So your line of code should run if replace x=0 if wage>1 & lfp=0, and so on...

mhassel2

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: HW2 Q2c
« Reply #2 on: February 21, 2017, 09:29:39 PM »
For the second part of the question, how would you answer "However, if we have any observation(s) that violate at least one of the conditions, how would you deal with such observation(s) with invalid wage before conducting regression analysis?" if I did not find any violations?
« Last Edit: February 21, 2017, 09:42:00 PM by mhassel2 »

Roric Brown

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 43
    • View Profile
Re: HW2 Q2c
« Reply #3 on: February 21, 2017, 11:16:44 PM »
The second part of the question is not getting at whether or not there are observations that violate the conditions, but rather what you should do in STATA if there are observations that are invalid.  For example, some datasets have values that don't seem to make sense, but if you refer to the codebook it might tell you that x=100 means that data point is missing.  To ensure that this value of 100 does not throw off your regression you should alter the data in someway.