Modeling Binary Outcome in Stata 1


Giovanni Minchio
Yuxin Zhang


Quantitative Methods Lab, Lesson 7.2
14 Nov. 2024

Linear regression with a binary outcome?

Linear probability model (LPM) uses linear regression with a binary outcome with the values 0 and 1.

\[ Y_i = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i} + \dots + \beta_k X_{ki} + u_i \]

\[ P(Y = 1 \mid X_1, X_2, ..., X_{k}) \]

Example in Stata

cd "/Users/yuxin/Documents/STATALAB2024-25/DO_markdown"
use "../datafile/ESS10.dta", clear

Check variables included

Let’s say we are interested in how age agea, gender gndr, education edulvlb, country context cntry, and internet use in minutes netustm predict voting behavior (0/1).

desc vote agea gndr edulvlb cntry netustm
Variable      Storage   Display    Value
    name         type    format    label      Variable label
------------------------------------------------------------------------------------------------------------------------
vote            byte    %3.0g      vote       Voted last national election
agea            int     %5.0g      agea       Age of respondent, calculated
gndr            byte    %3.0g      gndr       Gender
edulvlb         int     %6.0g      edulvlb    Highest level of education
cntry           str2    %2s                   Country
netustm         int     %6.0g      netustm    Internet use, how much time on typical day, in minutes
tab1 vote agea gndr edulvlb cntry netustm
-> tabulation of vote  

 Voted last national |
            election |      Freq.     Percent        Cum.
---------------------+-----------------------------------
                 Yes |     26,794       72.12       72.12
                  No |      7,764       20.90       93.02
Not eligible to vote |      2,594        6.98      100.00
---------------------+-----------------------------------
               Total |     37,152      100.00

-> tabulation of agea  

       Age of |
  respondent, |
   calculated |      Freq.     Percent        Cum.
--------------+-----------------------------------
           15 |         99        0.27        0.27
           16 |        267        0.72        0.98
           17 |        360        0.96        1.95
           18 |        402        1.08        3.02
           19 |        458        1.23        4.25
           20 |        385        1.03        5.28
           21 |        457        1.22        6.51
           22 |        452        1.21        7.72
           23 |        400        1.07        8.79
           24 |        389        1.04        9.83
           25 |        419        1.12       10.95
           26 |        423        1.13       12.09
           27 |        401        1.07       13.16
           28 |        451        1.21       14.37
           29 |        448        1.20       15.57
           30 |        486        1.30       16.87
           31 |        492        1.32       18.19
           32 |        517        1.39       19.58
           33 |        536        1.44       21.01
           34 |        488        1.31       22.32
           35 |        555        1.49       23.81
           36 |        584        1.56       25.37
           37 |        550        1.47       26.85
           38 |        568        1.52       28.37
           39 |        566        1.52       29.89
           40 |        598        1.60       31.49
           41 |        680        1.82       33.31
           42 |        600        1.61       34.92
           43 |        593        1.59       36.51
           44 |        567        1.52       38.03
           45 |        598        1.60       39.63
           46 |        656        1.76       41.39
           47 |        609        1.63       43.02
           48 |        623        1.67       44.69
           49 |        649        1.74       46.43
           50 |        653        1.75       48.18
           51 |        687        1.84       50.02
           52 |        672        1.80       51.82
           53 |        662        1.77       53.59
           54 |        621        1.66       55.26
           55 |        653        1.75       57.01
           56 |        715        1.92       58.92
           57 |        664        1.78       60.70
           58 |        687        1.84       62.54
           59 |        660        1.77       64.31
           60 |        687        1.84       66.15
           61 |        728        1.95       68.10
           62 |        673        1.80       69.91
           63 |        634        1.70       71.60
           64 |        598        1.60       73.21
           65 |        630        1.69       74.89
           66 |        677        1.81       76.71
           67 |        657        1.76       78.47
           68 |        609        1.63       80.10
           69 |        587        1.57       81.67
           70 |        630        1.69       83.36
           71 |        630        1.69       85.05
           72 |        573        1.54       86.59
           73 |        521        1.40       87.98
           74 |        477        1.28       89.26
           75 |        506        1.36       90.62
           76 |        444        1.19       91.81
           77 |        393        1.05       92.86
           78 |        326        0.87       93.73
           79 |        310        0.83       94.56
           80 |        312        0.84       95.40
           81 |        307        0.82       96.22
           82 |        278        0.74       96.97
           83 |        213        0.57       97.54
           84 |        182        0.49       98.03
           85 |        159        0.43       98.45
           86 |        150        0.40       98.85
           87 |         98        0.26       99.12
           88 |         86        0.23       99.35
           89 |         93        0.25       99.60
           90 |        151        0.40      100.00
--------------+-----------------------------------
        Total |     37,319      100.00

-> tabulation of gndr  

     Gender |      Freq.     Percent        Cum.
------------+-----------------------------------
       Male |     17,463       46.43       46.43
     Female |     20,148       53.57      100.00
------------+-----------------------------------
      Total |     37,611      100.00

-> tabulation of edulvlb  

             Highest level of education |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
            Not completed ISCED level 1 |        317        0.85        0.85
   ISCED 1, completed primary education |      2,252        6.01        6.86
Vocational ISCED 2C < 2 years, no acces |          8        0.02        6.88
General/pre-vocational ISCED 2A/2B, acc |        223        0.60        7.48
General ISCED 2A, access ISCED 3A gener |      4,358       11.64       19.11
Vocational ISCED 2C >= 2 years, no acce |         44        0.12       19.23
Vocational ISCED 2A/2B, access ISCED 3  |        341        0.91       20.14
Vocational ISCED 2, access ISCED 3 gene |         44        0.12       20.26
Vocational ISCED 3C < 2 years, no acces |        508        1.36       21.62
General ISCED 3A/3B, access ISCED 5B/lo |         93        0.25       21.86
General ISCED 3A, access upper tier ISC |      5,304       14.16       36.03
Vocational ISCED 3C >= 2 years, no acce |      4,078       10.89       46.92
Vocational ISCED 3A, access ISCED 5B/ l |        666        1.78       48.69
Vocational ISCED 3A, access upper tier  |      5,386       14.38       63.08
General ISCED 4A/4B, access ISCED 5B/lo |         17        0.05       63.12
General ISCED 4A, access upper tier ISC |         19        0.05       63.17
ISCED 4 programmes without access ISCED |        836        2.23       65.40
Vocational ISCED 4A/4B, access ISCED 5B |         91        0.24       65.65
Vocational ISCED 4A, access upper tier  |        996        2.66       68.31
ISCED 5A short, intermediate/academic/g |        203        0.54       68.85
ISCED 5B short, advanced vocational qua |      1,626        4.34       73.19
ISCED 5A medium, bachelor/equivalent fr |      1,665        4.45       77.64
ISCED 5A medium, bachelor/equivalent fr |      3,133        8.37       86.00
ISCED 5A long, master/equivalent from l |        792        2.11       88.12
ISCED 5A long, master/equivalent from u |      3,961       10.58       98.69
               ISCED 6, doctoral degree |        408        1.09       99.78
                                  Other |         81        0.22      100.00
----------------------------------------+-----------------------------------
                                  Total |     37,450      100.00

-> tabulation of cntry  

    Country |      Freq.     Percent        Cum.
------------+-----------------------------------
         BE |      1,341        3.57        3.57
         BG |      2,718        7.23       10.79
         CH |      1,523        4.05       14.84
         CZ |      2,476        6.58       21.42
         EE |      1,542        4.10       25.52
         FI |      1,577        4.19       29.72
         FR |      1,977        5.26       34.97
         GB |      1,149        3.05       38.03
         GR |      2,799        7.44       45.47
         HR |      1,592        4.23       49.70
         HU |      1,849        4.92       54.62
         IE |      1,770        4.71       59.33
         IS |        903        2.40       61.73
         IT |      2,640        7.02       68.75
         LT |      1,659        4.41       73.16
         ME |      1,278        3.40       76.55
         MK |      1,429        3.80       80.35
         NL |      1,470        3.91       84.26
         NO |      1,411        3.75       88.01
         PT |      1,838        4.89       92.90
         SI |      1,252        3.33       96.23
         SK |      1,418        3.77      100.00
------------+-----------------------------------
      Total |     37,611      100.00

-> tabulation of netustm  

 Internet use, |
 how much time |
    on typical |
       day, in |
       minutes |      Freq.     Percent        Cum.
---------------+-----------------------------------
             0 |         43        0.16        0.16
             1 |          7        0.03        0.18
             2 |          7        0.03        0.21
             3 |          1        0.00        0.21
             5 |         21        0.08        0.29
             6 |         62        0.22        0.51
             7 |         24        0.09        0.60
             8 |         72        0.26        0.86
             9 |         28        0.10        0.96
            10 |        142        0.51        1.47
            14 |          1        0.00        1.48
            15 |        167        0.61        2.08
            18 |          1        0.00        2.09
            20 |        126        0.46        2.54
            25 |         10        0.04        2.58
            28 |          1        0.00        2.58
            30 |      1,034        3.75        6.33
            31 |          1        0.00        6.33
            35 |          8        0.03        6.36
            38 |          2        0.01        6.37
            40 |         61        0.22        6.59
            45 |        229        0.83        7.42
            50 |         52        0.19        7.61
            55 |          8        0.03        7.64
            59 |          2        0.01        7.65
            60 |      3,401       12.32       19.97
            61 |          6        0.02       19.99
            63 |          2        0.01       20.00
            64 |          2        0.01       20.01
            65 |         18        0.07       20.07
            68 |          4        0.01       20.08
            69 |          1        0.00       20.09
            70 |         55        0.20       20.29
            71 |          2        0.01       20.29
            72 |          1        0.00       20.30
            74 |          1        0.00       20.30
            75 |         65        0.24       20.54
            78 |          1        0.00       20.54
            80 |         80        0.29       20.83
            85 |         10        0.04       20.87
            88 |          2        0.01       20.87
            90 |      1,393        5.05       25.92
            95 |          7        0.03       25.95
            98 |          2        0.01       25.95
            99 |          1        0.00       25.96
           100 |         20        0.07       26.03
           105 |         49        0.18       26.21
           110 |         43        0.16       26.36
           115 |          4        0.01       26.38
           118 |          1        0.00       26.38
           119 |          5        0.02       26.40
           120 |      4,432       16.06       42.46
           121 |          3        0.01       42.47
           122 |          6        0.02       42.49
           123 |          5        0.02       42.51
           125 |          5        0.02       42.53
           128 |          9        0.03       42.56
           130 |         34        0.12       42.68
           132 |          1        0.00       42.69
           133 |          1        0.00       42.69
           135 |         43        0.16       42.85
           138 |          1        0.00       42.85
           140 |         50        0.18       43.03
           143 |          1        0.00       43.04
           145 |          1        0.00       43.04
           150 |      1,106        4.01       47.05
           155 |          3        0.01       47.06
           158 |          4        0.01       47.07
           160 |         24        0.09       47.16
           165 |         29        0.11       47.26
           168 |          1        0.00       47.27
           170 |         13        0.05       47.32
           175 |          1        0.00       47.32
           177 |          1        0.00       47.32
           180 |      3,147       11.40       58.73
           181 |          3        0.01       58.74
           182 |          2        0.01       58.74
           183 |          5        0.02       58.76
           185 |         14        0.05       58.81
           188 |          2        0.01       58.82
           189 |          1        0.00       58.82
           190 |         24        0.09       58.91
           192 |          2        0.01       58.92
           195 |         17        0.06       58.98
           196 |          1        0.00       58.98
           198 |          1        0.00       58.99
           200 |         32        0.12       59.10
           202 |          1        0.00       59.11
           204 |          1        0.00       59.11
           205 |          5        0.02       59.13
           210 |        537        1.95       61.07
           215 |          3        0.01       61.08
           220 |          3        0.01       61.10
           225 |         12        0.04       61.14
           230 |         21        0.08       61.21
           240 |      2,207        8.00       69.21
           242 |          1        0.00       69.22
           243 |          1        0.00       69.22
           244 |          3        0.01       69.23
           245 |          1        0.00       69.23
           246 |          1        0.00       69.24
           248 |          1        0.00       69.24
           250 |          9        0.03       69.27
           255 |          8        0.03       69.30
           256 |          1        0.00       69.31
           260 |         21        0.08       69.38
           264 |          1        0.00       69.39
           265 |          4        0.01       69.40
           270 |        353        1.28       70.68
           271 |          1        0.00       70.68
           275 |          2        0.01       70.69
           276 |          1        0.00       70.69
           278 |          1        0.00       70.70
           280 |         10        0.04       70.73
           285 |          6        0.02       70.76
           290 |          4        0.01       70.77
           299 |          1        0.00       70.77
           300 |      1,948        7.06       77.83
           301 |          4        0.01       77.85
           302 |          1        0.00       77.85
           304 |          1        0.00       77.85
           305 |          3        0.01       77.86
           308 |          3        0.01       77.88
           310 |         11        0.04       77.92
           311 |          1        0.00       77.92
           315 |          6        0.02       77.94
           320 |         12        0.04       77.98
           325 |          2        0.01       77.99
           328 |          1        0.00       77.99
           330 |        234        0.85       78.84
           333 |          1        0.00       78.85
           338 |          1        0.00       78.85
           340 |          4        0.01       78.86
           345 |          3        0.01       78.88
           350 |         11        0.04       78.92
           359 |          1        0.00       78.92
           360 |      1,205        4.37       83.29
           361 |          2        0.01       83.29
           362 |          1        0.00       83.30
           363 |          1        0.00       83.30
           365 |          2        0.01       83.31
           368 |          2        0.01       83.31
           370 |          5        0.02       83.33
           375 |          4        0.01       83.35
           377 |          1        0.00       83.35
           380 |          7        0.03       83.38
           390 |        126        0.46       83.83
           400 |          3        0.01       83.84
           405 |          6        0.02       83.86
           410 |          6        0.02       83.89
           420 |        482        1.75       85.63
           425 |          4        0.01       85.65
           430 |          4        0.01       85.66
           435 |          2        0.01       85.67
           440 |          2        0.01       85.68
           445 |          1        0.00       85.68
           450 |         62        0.22       85.90
           460 |          1        0.00       85.91
           470 |          2        0.01       85.92
           480 |      1,315        4.76       90.68
           481 |          1        0.00       90.68
           485 |          1        0.00       90.69
           488 |          6        0.02       90.71
           489 |          1        0.00       90.71
           490 |          5        0.02       90.73
           492 |          1        0.00       90.73
           495 |          3        0.01       90.75
           500 |          5        0.02       90.76
           505 |          1        0.00       90.77
           510 |         95        0.34       91.11
           520 |          4        0.01       91.13
           525 |          2        0.01       91.13
           530 |          2        0.01       91.14
           533 |          1        0.00       91.14
           540 |        406        1.47       92.62
           545 |          1        0.00       92.62
           555 |          1        0.00       92.62
           560 |          1        0.00       92.63
           570 |         53        0.19       92.82
           580 |          1        0.00       92.82
           585 |          1        0.00       92.83
           590 |          4        0.01       92.84
           595 |          6        0.02       92.86
           599 |          2        0.01       92.87
           600 |      1,126        4.08       96.95
           601 |          1        0.00       96.95
           602 |          1        0.00       96.96
           608 |          1        0.00       96.96
           609 |          1        0.00       96.96
           610 |          3        0.01       96.97
           615 |          2        0.01       96.98
           620 |          4        0.01       97.00
           630 |         29        0.11       97.10
           640 |          1        0.00       97.10
           650 |          2        0.01       97.11
           660 |        108        0.39       97.50
           665 |          1        0.00       97.51
           690 |          5        0.02       97.53
           720 |        428        1.55       99.08
           732 |          1        0.00       99.08
           735 |          1        0.00       99.08
           740 |          2        0.01       99.09
           745 |          1        0.00       99.09
           750 |         13        0.05       99.14
           765 |          1        0.00       99.14
           780 |         31        0.11       99.26
           810 |          1        0.00       99.26
           840 |         58        0.21       99.47
           870 |          1        0.00       99.47
           899 |          2        0.01       99.48
           900 |         60        0.22       99.70
           930 |          2        0.01       99.71
           940 |          1        0.00       99.71
           960 |         37        0.13       99.84
           990 |          1        0.00       99.85
          1020 |          5        0.02       99.87
          1038 |          1        0.00       99.87
          1080 |         13        0.05       99.92
          1140 |          1        0.00       99.92
          1200 |         12        0.04       99.96
          1380 |          3        0.01       99.97
          1440 |          7        0.03      100.00
---------------+-----------------------------------
         Total |     27,598      100.00

Recode variables

keep if cntry == "GB" | cntry == "NO" | cntry == "FR" | cntry == "IT" 
tab cntry
(30,434 observations deleted)

    Country |      Freq.     Percent        Cum.
------------+-----------------------------------
         FR |      1,977       27.55       27.55
         GB |      1,149       16.01       43.56
         IT |      2,640       36.78       80.34
         NO |      1,411       19.66      100.00
------------+-----------------------------------
      Total |      7,177      100.00
help encode

label def cntry_4 0 "NO" 1 "IT" 2 "FR" 3"GB"
encode cntry, gen(cntry_4) label(cntry_4)
tab cntry_4
label list cntry_4
    Country |      Freq.     Percent        Cum.
------------+-----------------------------------
         NO |      1,411       19.66       19.66
         IT |      2,640       36.78       56.44
         FR |      1,977       27.55       83.99
         GB |      1,149       16.01      100.00
------------+-----------------------------------
      Total |      7,177      100.00

cntry_4:
           0 NO
           1 IT
           2 FR
           3 GB
label list vote
drop if vote == 3
recode vote (1 = 1) (2 = 0), gen(vote_bi)
tab vote_bi
vote:
           1 Yes
           2 No
           3 Not eligible to vote
          .a Refusal
          .b Don't know
          .c No answer

(742 observations deleted)

(1,480 differences between vote and vote_bi)


  RECODE of |
vote (Voted |
       last |
   national |
  election) |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,480       23.47       23.47
          1 |      4,825       76.53      100.00
------------+-----------------------------------
      Total |      6,305      100.00
keep if agea >= 25 & agea <= 60
(2,725 observations deleted)
label list gndr
recode gndr (1 = 0) (2 = 1), gen(gndr_bi)
tab gndr_bi
gndr:
           1 Male
           2 Female
          .a No answer

(3,710 differences between gndr and gndr_bi)


  RECODE of |
       gndr |
   (Gender) |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,797       48.44       48.44
          1 |      1,913       51.56      100.00
------------+-----------------------------------
      Total |      3,710      100.00
label list edulvlb
recode edulvlb (0/520 = 0) (610/888 = 1) (5555 = .), gen(edu_bi)
edulvlb:
           0 Not completed ISCED level 1
         113 ISCED 1, completed primary education
         129 Vocational ISCED 2C < 2 years, no access ISCED 3
         212 General/pre-vocational ISCED 2A/2B, access ISCED 3 vocational
         213 General ISCED 2A, access ISCED 3A general/all 3
         221 Vocational ISCED 2C >= 2 years, no access ISCED 3
         222 Vocational ISCED 2A/2B, access ISCED 3 vocational
         223 Vocational ISCED 2, access ISCED 3 general/all
         229 Vocational ISCED 3C < 2 years, no access ISCED 5
         311 General ISCED 3 >=2 years, no access ISCED 5
         312 General ISCED 3A/3B, access ISCED 5B/lower tier 5A
         313 General ISCED 3A, access upper tier ISCED 5A/all 5
         321 Vocational ISCED 3C >= 2 years, no access ISCED 5
         322 Vocational ISCED 3A, access ISCED 5B/ lower tier 5A
         323 Vocational ISCED 3A, access upper tier ISCED 5A/all 5
         412 General ISCED 4A/4B, access ISCED 5B/lower tier 5A
         413 General ISCED 4A, access upper tier ISCED 5A/all 5
         421 ISCED 4 programmes without access ISCED 5
         422 Vocational ISCED 4A/4B, access ISCED 5B/lower tier 5A
         423 Vocational ISCED 4A, access upper tier ISCED 5A/all 5
         510 ISCED 5A short, intermediate/academic/general tertiary below bachelor
         520 ISCED 5B short, advanced vocational qualifications
         610 ISCED 5A medium, bachelor/equivalent from lower tier tertiary
         620 ISCED 5A medium, bachelor/equivalent from upper/single tier tertiary
         710 ISCED 5A long, master/equivalent from lower tier tertiary
         720 ISCED 5A long, master/equivalent from upper/single tier tertiary
         800 ISCED 6, doctoral degree
        5555 Other
          .a Refusal
          .b Don't know
          .c No answer

(3,678 differences between edulvlb and edu_bi)

Check key variables again

tab vote_bi cntry_4
 RECODE of |
      vote |
    (Voted |
      last |
  national |                   Country
 election) |        NO         IT         FR         GB |     Total
-----------+--------------------------------------------+----------
         0 |        72        259        433        129 |       893 
         1 |       718      1,049        561        417 |     2,745 
-----------+--------------------------------------------+----------
     Total |       790      1,308        994        546 |     3,638 
scatter vote_bi agea || lowess vote_bi agea

scatter vote_bi agea || lfit (vote_bi agea)

Run LPM with robust standard errors

regress vote_bi agea, robust 

regress vote_bi agea i.edu_bi, robust 

regress vote_bi agea i.edu_bi netustm, robust 

regress vote_bi agea i.edu_bi netustm i.gndr_bi, robust 

regress vote_bi agea i.edu_bi netustm i.gndr_bi i.cntry_4, robust 
Linear regression                               Number of obs     =      3,638
                                                F(1, 3636)        =      63.98
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0180
                                                Root MSE          =     .42658

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |   .0056776   .0007098     8.00   0.000     .0042859    .0070693
       _cons |   .5022229    .033343    15.06   0.000       .43685    .5675958
------------------------------------------------------------------------------


Linear regression                               Number of obs     =      3,611
                                                F(2, 3608)        =     103.39
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0504
                                                Root MSE          =     .41948

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |   .0067363   .0007065     9.53   0.000     .0053511    .0081215
    1.edu_bi |   .1633984   .0137552    11.88   0.000     .1364296    .1903671
       _cons |   .3985797   .0344417    11.57   0.000     .3310525    .4661069
------------------------------------------------------------------------------


Linear regression                               Number of obs     =      3,279
                                                F(3, 3275)        =      72.61
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0624
                                                Root MSE          =     .40959

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |   .0084535   .0007334    11.53   0.000     .0070155    .0098914
    1.edu_bi |   .1423356   .0145026     9.81   0.000     .1139006    .1707706
     netustm |   .0000658   .0000396     1.66   0.097    -.0000118    .0001435
       _cons |   .3268182   .0380458     8.59   0.000     .2522222    .4014142
------------------------------------------------------------------------------


Linear regression                               Number of obs     =      3,279
                                                F(4, 3274)        =      54.47
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0624
                                                Root MSE          =     .40965

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |    .008453   .0007335    11.52   0.000     .0070148    .0098911
    1.edu_bi |   .1424021   .0145782     9.77   0.000     .1138188    .1709855
     netustm |   .0000657   .0000396     1.66   0.098     -.000012    .0001434
   1.gndr_bi |  -.0009763   .0143892    -0.07   0.946     -.029189    .0272364
       _cons |   .3273472   .0387782     8.44   0.000     .2513153    .4033791
------------------------------------------------------------------------------


Linear regression                               Number of obs     =      3,279
                                                F(7, 3271)        =      77.11
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1412
                                                Root MSE          =     .39223

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |   .0082132   .0007075    11.61   0.000      .006826    .0096003
    1.edu_bi |   .1274084   .0143858     8.86   0.000     .0992024    .1556144
     netustm |   .0000223   .0000386     0.58   0.563    -.0000534    .0000981
   1.gndr_bi |  -.0016086   .0137437    -0.12   0.907    -.0285558    .0253385
             |
     cntry_4 |
         IT  |  -.0549815   .0162725    -3.38   0.001    -.0868868   -.0230762
         FR  |  -.3062807   .0194974   -15.71   0.000     -.344509   -.2680524
         GB  |  -.1251441   .0203418    -6.15   0.000    -.1650281   -.0852602
             |
       _cons |   .4760632   .0397109    11.99   0.000     .3982024    .5539239
------------------------------------------------------------------------------
regress vote_bi agea i.edu_bi netustm i.gndr_bi i.cntry_4, robust 
Linear regression                               Number of obs     =      3,279
                                                F(7, 3271)        =      77.11
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1412
                                                Root MSE          =     .39223

------------------------------------------------------------------------------
             |               Robust
     vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        agea |   .0082132   .0007075    11.61   0.000      .006826    .0096003
    1.edu_bi |   .1274084   .0143858     8.86   0.000     .0992024    .1556144
     netustm |   .0000223   .0000386     0.58   0.563    -.0000534    .0000981
   1.gndr_bi |  -.0016086   .0137437    -0.12   0.907    -.0285558    .0253385
             |
     cntry_4 |
         IT  |  -.0549815   .0162725    -3.38   0.001    -.0868868   -.0230762
         FR  |  -.3062807   .0194974   -15.71   0.000     -.344509   -.2680524
         GB  |  -.1251441   .0203418    -6.15   0.000    -.1650281   -.0852602
             |
       _cons |   .4760632   .0397109    11.99   0.000     .3982024    .5539239
------------------------------------------------------------------------------
regress, coeflegend
Linear regression                               Number of obs     =      3,279
                                                F(7, 3271)        =      77.11
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1412
                                                Root MSE          =     .39223

------------------------------------------------------------------------------
     vote_bi | Coefficient  Legend
-------------+----------------------------------------------------------------
        agea |   .0082132  _b[agea]
    1.edu_bi |   .1274084  _b[1.edu_bi]
     netustm |   .0000223  _b[netustm]
   1.gndr_bi |  -.0016086  _b[1.gndr_bi]
             |
     cntry_4 |
         IT  |  -.0549815  _b[1.cntry_4]
         FR  |  -.3062807  _b[2.cntry_4]
         GB  |  -.1251441  _b[3.cntry_4]
             |
       _cons |   .4760632  _b[_cons]
------------------------------------------------------------------------------

P.s., as we endorse theory-informed models, you don’t drop a predictor simply because it’s not statistically significant or has a minimal effect!

Interaction in LPM

We think the effect of gender on voting probability varies differs by country contexts.

regress vote_bi agea i.edu_bi netustm i.gndr_bi i.cntry_4 i.gndr_bi#i.cntry_4, robust 
Linear regression                               Number of obs     =      3,279
                                                F(10, 3268)       =      54.35
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1422
                                                Root MSE          =     .39219

---------------------------------------------------------------------------------
                |               Robust
        vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
----------------+----------------------------------------------------------------
           agea |    .008184   .0007081    11.56   0.000     .0067957    .0095723
       1.edu_bi |   .1276086    .014386     8.87   0.000     .0994021    .1558151
        netustm |   .0000193   .0000386     0.50   0.618    -.0000564    .0000949
      1.gndr_bi |  -.0002859   .0206182    -0.01   0.989    -.0407118      .04014
                |
        cntry_4 |
            IT  |  -.0660775   .0230388    -2.87   0.004    -.1112494   -.0209056
            FR  |   -.307611   .0275381   -11.17   0.000    -.3616047   -.2536173
            GB  |  -.0919438   .0299912    -3.07   0.002    -.1507472   -.0331404
                |
gndr_bi#cntry_4 |
          1#IT  |   .0210185   .0307938     0.68   0.495    -.0393585    .0813956
          1#FR  |   .0021501     .03786     0.06   0.955    -.0720816    .0763818
          1#GB  |  -.0589122   .0406298    -1.45   0.147    -.1385746    .0207503
                |
          _cons |   .4775582   .0401806    11.89   0.000     .3987765    .5563399
---------------------------------------------------------------------------------
regress vote_bi agea i.edu_bi netustm i.gndr_bi##i.cntry_4, robust 
Linear regression                               Number of obs     =      3,279
                                                F(10, 3268)       =      54.35
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1422
                                                Root MSE          =     .39219

---------------------------------------------------------------------------------
                |               Robust
        vote_bi | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
----------------+----------------------------------------------------------------
           agea |    .008184   .0007081    11.56   0.000     .0067957    .0095723
       1.edu_bi |   .1276086    .014386     8.87   0.000     .0994021    .1558151
        netustm |   .0000193   .0000386     0.50   0.618    -.0000564    .0000949
      1.gndr_bi |  -.0002859   .0206182    -0.01   0.989    -.0407118      .04014
                |
        cntry_4 |
            IT  |  -.0660775   .0230388    -2.87   0.004    -.1112494   -.0209056
            FR  |   -.307611   .0275381   -11.17   0.000    -.3616047   -.2536173
            GB  |  -.0919438   .0299912    -3.07   0.002    -.1507472   -.0331404
                |
gndr_bi#cntry_4 |
          1#IT  |   .0210185   .0307938     0.68   0.495    -.0393585    .0813956
          1#FR  |   .0021501     .03786     0.06   0.955    -.0720816    .0763818
          1#GB  |  -.0589122   .0406298    -1.45   0.147    -.1385746    .0207503
                |
          _cons |   .4775582   .0401806    11.89   0.000     .3987765    .5563399
---------------------------------------------------------------------------------

Plot predicted probabilities with margins

margins cntry_4
Predictive margins                                       Number of obs = 3,279
Model VCE: Robust

Expression: Linear prediction, predict()

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
     cntry_4 |
         NO  |   .8886054   .0109678    81.02   0.000      .867101    .9101099
         IT  |   .8333289   .0114871    72.54   0.000     .8108062    .8558516
         FR  |   .5820993   .0159138    36.58   0.000     .5508972    .6133013
         GB  |   .7663881   .0177623    43.15   0.000     .7315616    .8012145
------------------------------------------------------------------------------
marginsplot

margins cntry_4#gndr_bi
marginsplot

margins cntry_4#gndr_bi, over(edu_bi)
marginsplot

Next: Binary logistic regression