Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regression with binary dependent variable

    Dear all,
    I'm a student and a new user of Stata. I have some problems with the following regression. The purpose of my analysis is to see what is the relationship between age and the probability of being employed during the Great Recession. For this reason, I have created a binary variable called "young" and have used several control variables in a probit model. Basically, when I use the marginsplot command I can see a difference in the probability of being employed between those who are young and those who are not, particularly high for the lower weekly earnings values. However, when I create a new dummy variable "poor" and insert the interaction term "youngpoor" in another regression, the interaction coefficient is not statistically significant (both if I use a probit model both if I use a linear regression model) and I can't understand why.

    I attach the files that describe the variables used and a short do-file to be able to replicate my results. The data file contains data on 5412 workers who were survey in the April 2008 Current Population Survey and reported that they were employed. The data file contains their employment status in April 2009, one year later, along with some additional variables.

    Thanks in advance for your reply
    Attached Files
    Last edited by Alessandro Manca; 30 Aug 2022, 11:12.

  • #2
    Alessandro:
    please use CODE delimiters and/or -dataex- to share what you typed and what Stata gave you back. Thanks.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Alessandro:
      please use CODE delimiters and/or -dataex- to share what you typed and what Stata gave you back. Thanks.
      Well since I am so nosy I already opened it. OP, I can help you out this time. In future please read and follow the FAQ before posting.

      Here is 200 sample cases:

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input byte(age race) double earnwke float(employed married union ne_states so_states ce_states private educ_lths educ_hs educ_somecol educ_aa educ_bac female)
      53 1       . 1 1 0 0 0 1 0 0 0 1 0 0 0
      39 1       . 1 1 0 0 0 1 0 0 0 0 0 1 1
      41 1     500 1 1 0 0 1 0 1 0 0 1 0 0 1
      27 1     520 1 1 0 0 1 0 1 1 0 0 0 0 0
      29 3     615 1 0 0 0 1 0 0 0 0 0 0 0 0
      50 3  865.38 1 1 0 0 0 0 0 0 0 0 0 1 1
      27 1   712.5 1 0 0 0 1 0 1 0 0 0 0 1 0
      24 1  711.53 0 0 1 0 1 0 0 0 0 0 0 0 1
      63 2     440 1 0 0 0 1 0 1 0 1 0 0 0 1
      43 1       . 1 0 0 0 1 0 0 0 0 1 0 0 1
      53 1  553.84 1 1 0 0 1 0 0 0 1 0 0 0 0
      51 1     600 1 1 0 0 1 0 0 0 0 1 0 0 1
      42 1 1730.76 1 1 0 1 0 0 1 0 1 0 0 0 0
      36 1   181.5 1 1 0 1 0 0 1 0 0 0 0 1 1
      57 1    1442 1 1 0 0 0 0 1 0 0 0 0 0 0
      39 1  980.76 1 0 0 0 0 0 1 0 0 0 0 1 1
      55 1    1216 1 1 0 0 1 0 1 0 1 0 0 0 0
      45 3  2692.3 1 1 0 0 1 0 1 0 0 0 0 0 0
      36 3  807.69 0 1 0 0 1 0 1 0 0 0 0 1 1
      47 2     750 1 1 0 0 1 0 1 0 0 1 0 0 0
      45 2  769.23 1 1 0 0 1 0 1 0 1 0 0 0 1
      40 1  1192.3 1 1 0 0 0 0 1 0 0 0 0 1 0
      33 1     480 0 1 0 0 0 1 1 0 1 0 0 0 1
      43 2     961 1 1 0 0 1 0 1 0 1 0 0 0 0
      38 2     590 1 1 0 0 1 0 1 0 0 0 0 1 1
      40 3 1153.84 1 1 0 0 0 0 1 0 0 0 1 0 0
      46 3  730.76 1 1 0 0 0 0 0 0 0 0 0 1 1
      57 1       . 1 1 0 0 0 0 0 0 0 0 0 1 0
      22 1     660 1 0 0 0 0 0 1 0 0 0 0 1 1
      58 1     538 1 1 1 0 0 0 1 0 0 1 0 0 1
      34 1     450 1 1 0 0 1 0 1 1 0 0 0 0 0
      33 1     576 1 1 0 0 1 0 1 0 0 1 0 0 1
      40 1       . 1 1 0 0 0 1 0 0 0 0 0 1 1
      25 1   692.3 1 0 0 0 1 0 0 0 1 0 0 0 0
      47 1     160 0 0 0 0 1 0 1 0 0 0 0 1 1
      42 1      18 1 0 0 0 0 0 1 0 0 0 1 0 0
      61 1  644.23 1 1 1 1 0 0 0 0 0 0 0 1 1
      62 1       . 1 1 0 0 1 0 0 0 0 0 1 0 0
      60 1   508.4 1 1 0 0 0 0 1 0 0 0 0 0 0
      58 1    1600 1 1 0 0 0 0 1 0 0 0 0 1 1
      44 1 1115.38 1 1 0 0 0 1 1 0 0 1 0 0 0
      44 1 1291.25 1 1 0 0 0 1 1 0 0 0 0 1 1
      24 1     500 1 0 0 0 1 0 1 0 0 0 0 1 1
      59 1 2884.61 1 1 0 1 0 0 1 0 0 0 0 0 0
      54 1     850 1 1 1 1 0 0 1 0 1 0 0 0 0
      57 3    1360 0 1 0 0 0 0 1 0 0 0 0 1 0
      52 1    2120 1 1 0 0 0 0 1 0 0 0 0 1 1
      48 1       . 1 1 0 0 1 0 0 0 1 0 0 0 0
      56 1    1750 1 0 0 0 0 1 0 0 0 0 0 0 0
      40 1 1923.05 1 1 0 0 0 0 1 0 0 0 0 1 0
      35 1    2307 1 1 0 0 0 1 1 0 0 0 0 1 0
      36 1    1625 1 1 1 0 0 1 0 0 0 0 0 0 1
      27 1  736.25 1 0 0 0 0 1 1 0 0 0 0 1 1
      41 1     350 0 0 0 0 1 0 1 0 1 0 0 0 0
      59 1    1500 1 1 1 0 0 0 1 0 0 1 0 0 0
      60 1    1000 1 1 0 0 0 0 1 0 1 0 0 0 1
      55 1  230.76 1 0 1 0 0 1 0 0 1 0 0 0 1
      61 1       . 1 0 0 0 0 1 0 0 0 0 0 0 0
      41 1     340 1 0 0 0 1 0 1 0 0 1 0 0 1
      49 1       . 1 1 0 0 0 1 0 0 1 0 0 0 0
      49 1     858 1 1 0 0 0 1 1 0 0 0 0 1 1
      24 1     380 1 0 0 0 1 0 1 0 1 0 0 0 0
      23 1     460 1 0 0 0 1 0 1 0 1 0 0 0 0
      39 1     720 1 1 0 0 0 0 1 0 1 0 0 0 0
      45 1   446.8 1 1 0 0 0 0 1 0 1 0 0 0 1
      35 1    2884 1 0 1 0 1 0 1 0 1 0 0 0 0
      37 1     360 0 0 0 0 1 0 1 1 0 0 0 0 1
      41 1     400 1 0 0 0 1 0 0 0 0 0 1 0 1
      42 1  423.07 1 0 0 0 1 0 1 0 0 1 0 0 1
      35 1     600 1 1 0 0 0 1 1 1 0 0 0 0 0
      58 1   790.8 1 0 0 0 0 1 1 0 1 0 0 0 0
      48 1    1442 1 0 0 1 0 0 1 0 0 0 1 0 0
      35 1 1384.61 1 0 0 0 1 0 1 0 0 0 0 0 1
      61 1       . 1 0 0 1 0 0 0 0 0 0 0 0 0
      48 1    2403 1 0 0 1 0 0 1 0 0 0 0 1 1
      46 1       . 1 0 0 0 1 0 0 0 1 0 0 0 0
      47 1       . 1 1 0 0 0 0 0 0 0 0 1 0 0
      31 1     425 1 0 0 0 1 0 1 0 1 0 0 0 1
      61 1       . 1 1 0 0 0 1 0 0 0 0 0 1 0
      60 1   658.1 1 1 0 0 0 1 1 0 0 0 0 0 1
      38 2    1600 1 1 1 0 0 1 1 0 0 1 0 0 0
      57 1     441 1 0 0 0 0 1 1 0 1 0 0 0 1
      58 1 1634.61 1 1 0 0 0 0 1 0 0 0 0 0 0
      51 1 1615.38 1 1 0 0 0 0 1 0 1 0 0 0 0
      52 1     423 1 1 1 0 0 0 0 0 0 0 0 1 1
      37 1    2000 0 1 0 0 0 0 1 0 0 1 0 0 0
      61 1 2884.61 1 0 0 0 1 0 1 0 0 1 0 0 1
      58 1  1045.2 1 1 0 0 0 0 0 0 1 0 0 0 0
      35 1     800 1 1 0 1 0 0 1 0 0 1 0 0 0
      28 1     600 1 1 0 1 0 0 1 0 1 0 0 0 1
      24 1  686.27 1 0 0 0 0 0 1 0 1 0 0 0 0
      47 1  288.46 1 1 0 1 0 0 1 0 0 1 0 0 1
      51 1     576 1 1 0 1 0 0 1 0 0 0 0 1 1
      43 1     140 1 1 0 0 0 0 1 0 1 0 0 0 1
      23 1     512 1 0 0 0 0 0 1 0 0 1 0 0 0
      31 1    2100 1 0 0 0 0 0 1 0 0 0 0 1 0
      55 1  961.53 1 1 1 0 0 1 0 0 0 0 0 1 0
      47 1    1500 0 1 1 0 0 1 0 0 0 0 0 0 1
      49 1     700 1 0 0 1 0 0 1 0 0 0 1 0 1
      42 1    2160 0 0 0 0 1 0 1 0 1 0 0 0 0
      21 1   206.8 1 0 0 1 0 0 1 0 0 1 0 0 0
      61 1   236.8 1 0 0 1 0 0 1 0 0 0 1 0 1
      56 1 1903.84 1 0 0 1 0 0 1 0 0 0 0 0 0
      62 2    1475 1 1 0 1 0 0 1 0 0 0 0 0 0
      24 2     400 0 0 0 1 0 0 1 0 0 0 0 1 1
      61 2  519.23 0 1 1 1 0 0 1 0 1 0 0 0 1
      53 2  480.76 1 1 1 0 1 0 0 0 0 0 0 1 0
      33 1  1307.2 1 1 0 0 0 0 0 0 0 0 1 0 0
      27 1  480.76 1 1 0 0 0 0 1 0 1 0 0 0 0
      27 1  826.92 0 1 1 0 0 0 0 0 0 0 0 0 1
      46 1    1250 1 1 0 0 0 0 0 0 0 0 0 0 0
      37 1     576 1 1 0 0 0 0 0 0 0 1 0 0 1
      62 1       . 1 1 0 0 0 1 0 0 1 0 0 0 0
      60 1       . 1 1 0 0 0 1 0 0 1 0 0 0 1
      42 1    1000 1 0 0 0 1 0 1 0 1 0 0 0 1
      57 1 1346.15 1 1 0 0 0 1 1 0 1 0 0 0 0
      56 1     337 0 1 0 0 0 1 1 0 1 0 0 0 1
      37 3    1346 1 0 0 0 1 0 1 0 0 0 0 0 1
      39 1 1538.46 1 1 0 0 1 0 1 0 1 0 0 0 0
      42 1       . 1 1 0 0 1 0 0 0 0 1 0 0 0
      48 1   212.5 1 1 0 0 1 0 0 0 1 0 0 0 1
      54 2       . 1 1 0 1 0 0 0 0 1 0 0 0 0
      18 2  230.76 1 0 0 1 0 0 1 0 0 1 0 0 1
      26 1     300 0 0 0 1 0 0 1 0 1 0 0 0 1
      54 1    2240 1 1 0 1 0 0 1 0 0 1 0 0 0
      23 1       . 1 0 0 1 0 0 0 0 0 1 0 0 0
      43 1  423.07 1 1 0 0 1 0 1 1 0 0 0 0 0
      41 1  279.65 1 1 0 0 1 0 1 0 1 0 0 0 1
      62 1 1980.76 1 1 0 0 1 0 1 0 0 1 0 0 1
      61 1       . 0 1 0 0 1 0 0 0 0 0 0 0 1
      26 1    1250 0 1 0 1 0 0 1 1 0 0 0 0 0
      27 1   603.6 0 1 0 1 0 0 1 0 0 0 0 1 1
      42 1    2403 1 1 0 0 1 0 1 0 0 0 0 1 0
      44 1    1307 1 1 0 0 1 0 1 0 0 0 0 1 1
      35 1    1346 1 1 0 0 1 0 1 0 1 0 0 0 0
      36 1     461 0 1 0 0 1 0 0 0 1 0 0 0 1
      34 1    1000 1 0 0 1 0 0 1 0 0 0 0 1 1
      42 2     250 1 0 0 0 1 0 1 0 1 0 0 0 0
      36 1       . 1 1 0 0 0 1 0 0 0 0 0 0 0
      40 1       . 1 1 0 1 0 0 0 0 1 0 0 0 0
      49 1 2788.46 1 1 0 0 1 0 1 0 0 0 0 0 0
      34 3     280 0 0 0 0 1 0 1 0 0 0 1 0 0
      31 2   676.8 1 1 0 0 1 0 1 0 0 1 0 0 0
      57 1  653.84 0 1 0 0 0 0 0 0 1 0 0 0 1
      39 1     920 1 1 0 0 0 0 1 0 1 0 0 0 0
      37 1     360 1 1 0 0 0 0 1 1 0 0 0 0 1
      50 2 1753.84 1 0 0 0 0 0 1 0 0 0 0 0 1
      36 2   287.5 1 0 0 0 0 1 1 1 0 0 0 0 1
      33 1    1664 1 1 1 1 0 0 0 0 0 0 1 0 0
      23 1     550 0 0 0 1 0 0 1 0 0 0 0 1 1
      48 1     668 1 1 0 1 0 0 1 0 0 0 1 0 1
      40 2 1153.84 1 1 0 0 1 0 0 0 0 0 0 1 1
      40 1    2403 1 1 0 0 1 0 1 0 0 0 0 1 0
      42 1     153 1 1 0 0 1 0 1 0 0 0 0 1 1
      45 1     769 1 1 0 1 0 0 1 0 1 0 0 0 0
      51 1       . 1 0 0 1 0 0 0 0 1 0 0 0 0
      46 1 1326.92 1 1 0 0 0 0 0 0 0 0 0 0 0
      45 1 1153.84 1 1 0 0 0 0 0 0 0 0 0 0 1
      45 1       . 1 1 0 0 1 0 0 0 1 0 0 0 0
      45 1     182 1 1 0 0 1 0 1 0 1 0 0 0 1
      36 1     350 1 1 0 0 0 1 1 1 0 0 0 0 0
      40 1   694.4 1 0 0 0 0 1 1 0 0 1 0 0 1
      58 1  923.07 1 1 0 0 0 1 1 0 0 0 0 0 0
      48 1  980.76 1 1 0 0 1 0 0 0 0 0 0 0 0
      40 1 1673.07 1 1 0 0 1 0 1 0 0 0 0 0 1
      51 1    2538 1 1 0 0 0 0 1 0 1 0 0 0 0
      47 1     360 0 1 0 0 0 0 1 1 0 0 0 0 1
      22 2  384.61 1 0 0 0 1 0 1 0 0 1 0 0 1
      49 2  961.53 1 0 0 0 1 0 0 0 0 1 0 0 1
      29 1     480 0 1 0 0 0 0 1 1 0 0 0 0 0
      25 1     390 1 1 0 0 0 0 1 1 0 0 0 0 1
      51 1     680 1 1 0 1 0 0 1 0 1 0 0 0 0
      51 1     992 1 1 0 1 0 0 1 0 0 0 1 0 1
      47 1  557.69 1 0 0 1 0 0 0 0 1 0 0 0 1
      31 1  923.07 1 0 0 0 1 0 1 0 0 1 0 0 0
      38 1       . 0 1 0 0 0 0 0 0 0 1 0 0 0
      30 1  307.69 1 1 0 0 0 0 0 0 1 0 0 0 1
      30 1     700 1 0 0 0 1 0 1 1 0 0 0 0 0
      37 1    1250 1 1 0 0 1 0 1 0 0 1 0 0 0
      36 1     807 1 1 0 0 1 0 1 0 0 0 0 1 1
      43 1  576.92 1 0 0 0 0 1 1 0 1 0 0 0 1
      53 1   200.4 1 1 0 0 1 0 1 0 0 1 0 0 1
      30 1     760 1 1 1 0 1 0 0 0 1 0 0 0 0
      34 1     452 0 1 0 0 1 0 1 0 1 0 0 0 1
      56 1  461.53 1 0 0 0 0 1 0 0 0 1 0 0 1
      46 1     860 0 1 0 0 0 0 1 1 0 0 0 0 0
      58 1   416.4 1 1 0 0 0 1 1 0 0 0 1 0 1
      25 1     673 1 0 0 0 0 0 1 0 0 1 0 0 1
      40 1    1480 1 0 0 0 0 1 1 0 0 0 0 1 0
      38 1     360 1 0 0 0 0 1 1 0 0 1 0 0 1
      42 1  480.76 1 0 0 0 0 0 1 0 1 0 0 0 1
      40 1       . 1 0 0 0 0 0 0 0 0 0 0 1 1
      31 1 2115.38 1 0 0 0 1 0 0 0 0 0 0 0 0
      27 1     800 1 0 0 0 1 0 1 0 0 0 0 1 1
      46 1    1400 1 1 0 0 0 0 0 0 0 0 0 0 0
      42 1     250 1 1 0 0 0 0 0 0 0 1 0 0 1
      37 1    1514 1 0 1 0 0 1 1 0 0 0 1 0 0
      38 1 1038.46 1 1 1 0 0 0 0 0 0 1 0 0 0
      57 2     440 1 0 1 0 1 0 0 0 1 0 0 0 1
      36 1    1100 1 0 0 0 1 0 1 0 0 0 0 1 0
      end
      And here is the do file:

      Code:
      *At first, I use only young variable
      generate young = age<25
      
      probit employed young female married race ne_states so_states ce_states private educ_lths educ_hs educ_somecol educ_aa educ_ba union earnwke, robust
      margins, at((means) _all earnwke=(0 500 1000 1500 2000 2500 3000) young==(0 1))
      marginsplot
      
      *Then, I use also poor and the interaction variable
      generate poor = earnwke<260
      generate youngpoor = young*poor
      probit employed young female married race ne_states so_states ce_states private educ_lths educ_hs educ_somecol educ_aa educ_ba union poor youngpoor, robust
      
      *So, I've tried with a LPM
      regress employed young female married race ne_states so_states ce_states private educ_lths educ_hs educ_somecol educ_aa educ_ba union poor youngpoor, robust
      Codebook:

      Click image for larger version

Name:	2022-08-30_14-31-41.jpg
Views:	1
Size:	290.8 KB
ID:	1679981

      Comment

      Working...
      X