Hello!
I am seeking for help with my data analysis. I am having a hard time getting a difference in marginal effects of an independent variable in two different models (same right-hand side variables and different outcome variables) in Stata. My data is an unbalanced panel (example data shown below) and the two models have two interaction terms. I am estimating marginal effects of a categorical variable (consisting one interaction term) in two different models and want to know the difference and its confident intervals of those marginal effects. The following shows some of my codes.
Then, I want to compare the marginal effects of grecession from the two models.
I've tried to search the Internet on this topic, but can't find the solution. I know the Stata command "suest" can compare coefficients/marginal effects of a variable across models. But this doesn't support my regression command, "reghdfe." I'm wondering if there is any way (manually or by user written commands) to estimate the difference in marginal effects across models when using reghdfe. I really appreciate your help in advance!
Thank you very much,
Hyun Ju
I am seeking for help with my data analysis. I am having a hard time getting a difference in marginal effects of an independent variable in two different models (same right-hand side variables and different outcome variables) in Stata. My data is an unbalanced panel (example data shown below) and the two models have two interaction terms. I am estimating marginal effects of a categorical variable (consisting one interaction term) in two different models and want to know the difference and its confident intervals of those marginal effects. The following shows some of my codes.
Code:
reghdfe pov c.ER##i.grecession c.ER##i.covid hhchildren hage hhigh i.famempsingle i.disability if singleheaded==1 & hfemale==1 [pw=lweight] ,absorb(id state) vce(cluster state) margins, dydx(grecession) reghdfe pov_nossdi c.ER##i.grecession c.ER##i.covid hhchildren hage hhigh i.famempsingle i.disability if singleheaded==1 & hfemale==1 [pw=lweight] ,absorb(id state) vce(cluster state) margins, dydx(grecession)
Then, I want to compare the marginal effects of grecession from the two models.
I've tried to search the Internet on this topic, but can't find the solution. I know the Stata command "suest" can compare coefficients/marginal effects of a variable across models. But this doesn't support my regression command, "reghdfe." I'm wondering if there is any way (manually or by user written commands) to estimate the difference in marginal effects across models when using reghdfe. I really appreciate your help in advance!
Thank you very much,
Hyun Ju
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(pov pov_nossdi ER grecession covid hhchildren hage hhigh famempsingle disability singleheaded hfemale lweight id state) 0 0 .625 0 0 1 35 1 . 0 0 0 18.149 6523 34 0 0 .641 0 0 1 29 1 . 0 0 0 23.885 6792 27 0 0 .633 0 0 1 29 1 2 0 1 1 . 10749 42 1 1 .573 0 0 1 48 0 2 0 1 1 . 13509 17 0 0 .633 0 0 1 50 0 . 0 0 0 53.976 207 42 0 0 .687 0 0 1 26 1 1 0 1 0 13.78 1811 5 0 0 .643 0 0 0 40 0 1 0 1 0 7.323 5052 10 0 0 .626 0 0 0 54 0 . 1 0 0 7.631 5506 32 1 1 .61 0 0 0 45 1 2 1 1 1 9.106 1459 21 0 0 .578 0 0 1 25 0 . 0 0 0 16.546 4869 23 0 0 .635 0 0 1 27 0 1 1 1 0 . 14692 13 0 0 .709 0 0 1 43 1 . 0 0 0 40.491 3703 22 0 0 .615 0 0 0 52 1 1 0 1 0 73.918 287 4 0 0 .643 0 0 1 45 1 . 0 0 0 39.177 2855 24 1 1 .615 0 0 1 46 0 . 1 0 0 31.684 5441 4 0 0 .633 0 0 1 26 0 1 0 1 1 . 9985 42 0 0 .678 0 0 0 52 1 . 0 0 0 34.157 392 14 0 0 .592 0 0 1 48 1 . 0 0 0 . 15882 9 0 0 .623 0 0 0 38 1 1 0 1 1 9.204 6526 12 0 0 .586 0 0 1 47 1 1 0 1 1 . 16061 16 0 0 .595 0 0 1 43 1 . 0 0 0 30.459 2661 39 0 0 .651 0 0 0 54 1 1 1 1 1 . 10733 45 0 0 .635 0 0 1 47 1 . 0 0 0 32.413 2763 13 1 1 .615 0 0 0 34 1 1 0 1 0 . 15516 4 1 1 .641 0 0 1 47 1 . 0 0 0 50.092 124 27 0 0 .626 0 0 0 43 0 1 1 1 1 22.186 2966 29 0 0 .643 0 0 1 32 1 . 0 0 0 53.835 51 10 0 0 .615 0 0 0 53 1 . 1 0 0 41.151 4838 4 0 0 .573 0 0 1 39 0 . 0 0 0 18.12 3444 17 0 0 .609 0 0 0 42 0 . 1 0 0 6.16 3919 37 0 0 .592 0 0 1 45 1 . 1 0 0 . 11416 9 1 1 .616 0 0 1 26 1 1 0 1 1 . 9214 2 0 0 .712 0 0 0 50 1 . 0 0 0 30.828 5452 26 0 0 .615 0 0 0 49 1 1 0 1 0 11.629 3439 4 0 0 .609 0 0 0 21 0 2 0 1 0 3.779 6729 37 0 0 .592 0 0 0 52 1 . 0 0 0 52.217 4380 9 0 0 .592 0 0 1 37 1 1 0 1 0 . 12930 9 0 0 .615 0 0 1 33 1 1 0 1 1 . 15368 4 0 0 .625 0 0 0 48 1 1 0 1 0 . 12784 34 0 0 .61 0 0 1 41 1 . 0 0 0 24.893 6288 21 0 0 .591 0 0 0 53 1 . 1 0 0 48.814 1771 31 0 0 .676 0 0 0 38 1 . 0 0 0 . 10303 43 0 0 .641 0 0 0 50 1 . 0 0 0 33.533 2778 27 0 0 .615 0 0 1 35 0 . 0 0 0 19.099 4800 4 1 1 .615 0 0 1 36 0 3 0 1 0 . 9764 4 0 0 .643 0 0 0 55 1 . 0 0 0 31.629 4473 24 1 1 .654 0 0 1 33 0 . 0 1 1 . 14796 19 0 0 .578 0 0 1 24 1 3 0 1 1 1.976 6801 23 1 1 .626 0 0 1 53 0 3 0 1 1 12.704 6492 32 0 0 .64 0 0 1 54 1 . 0 0 0 59.15 844 20 0 0 .683 0 0 0 33 1 . 0 0 0 27.814 458 28 0 0 .623 0 0 0 33 1 1 0 1 0 . 15747 12 0 0 .609 0 0 1 32 0 1 1 1 1 . 11648 37 0 0 .641 0 0 0 46 1 1 0 1 1 37.142 5462 27 0 0 .631 0 0 0 24 1 . 0 0 0 27.657 908 46 0 0 .635 0 0 1 53 1 . 1 0 0 . 10517 13 0 0 .615 0 0 1 30 0 1 0 1 0 . 13929 4 1 1 .633 0 0 0 58 0 3 1 1 0 . 15538 42 0 0 .623 0 0 0 20 1 1 0 1 0 . 9298 12 0 0 .654 0 0 1 34 1 1 0 1 0 . 15731 19 0 0 .626 0 0 1 25 1 . 0 0 0 11.984 3536 32 0 0 .654 0 0 1 33 1 . 0 0 0 . 12181 19 0 0 .643 0 0 0 43 1 . 1 0 0 26.846 6422 24 0 0 .615 0 0 1 32 1 1 0 1 1 4.317 1818 4 0 0 .586 0 0 1 52 1 1 0 1 1 . 9422 1 0 0 .586 0 0 1 40 1 . 0 0 0 . 15549 16 0 0 .578 0 0 1 28 0 1 0 1 0 .852 5465 23 0 0 .592 0 0 0 25 1 1 0 1 1 . 15387 9 0 0 .591 0 0 1 45 0 . 1 0 0 32.569 457 31 0 0 .632 0 0 0 48 1 . 0 0 0 31.643 6922 18 1 1 .626 0 0 0 48 1 2 0 1 1 8.407 2804 32 0 0 .626 0 0 1 55 1 1 1 1 1 18.179 7869 29 0 0 .651 0 0 0 44 1 1 0 1 0 51.878 8137 45 0 0 .626 0 0 1 33 1 . 0 0 0 20.294 3631 32 0 0 .635 0 0 0 64 0 3 0 1 1 27.464 2728 13 0 0 .643 0 0 1 30 1 . 0 0 0 . 13773 10 0 0 .631 0 0 0 27 1 . 0 0 0 . 15265 46 0 0 .615 0 0 1 31 1 . 1 0 0 33.897 8255 4 0 0 .625 0 0 0 64 1 . 1 0 0 70.489 8943 34 0 0 .633 0 0 0 49 1 1 0 1 1 . 10902 42 0 0 .654 0 0 1 35 1 1 0 1 1 15.461 6037 19 0 0 .64 0 0 0 42 1 1 0 1 0 32.748 5644 20 0 0 .586 0 0 0 29 1 2 0 1 1 . 15170 1 0 0 .631 0 0 1 31 1 3 1 1 0 . 12391 46 0 0 .676 0 0 0 62 1 . 1 0 0 . 9427 43 0 0 .615 0 0 0 53 0 . 0 0 0 35.916 486 4 1 1 .578 0 0 1 26 0 1 0 1 1 2.392 8177 23 0 0 .595 0 0 1 36 1 . 1 0 0 4.38 6721 39 0 0 .616 0 0 1 34 1 . 0 0 0 . 14997 2 0 0 .687 0 0 0 26 1 2 0 1 0 17.311 7571 5 0 0 .61 0 0 0 55 1 . 0 0 0 40.95 352 21 0 0 .651 0 0 0 54 1 . 0 0 0 . 15864 45 1 1 .622 0 0 0 44 1 . 0 1 0 3.475 2213 8 1 1 .578 0 0 0 53 1 1 0 1 1 10.415 2817 23 0 0 .589 0 0 1 34 1 . 1 0 0 47.969 615 3 0 0 .679 0 0 1 40 1 . 1 0 0 31.509 2291 48 0 0 .595 0 0 1 54 1 . 0 0 0 32.628 6764 39 0 0 .609 0 0 1 51 0 . 1 0 0 . 14449 37 0 0 .609 0 0 0 50 0 1 1 1 1 . 9430 37 0 0 .591 0 0 1 47 0 . 0 0 0 41.011 8399 31 end label values pov pov label def pov 0 "Not in poverty", modify label def pov 1 "In poverty", modify label values hfemale yesno label values hhchildren yesno label values disability yesno label def yesno 0 "no", modify label def yesno 1 "yes", modify label values hhigh highschool label def highschool 0 "Less than high school", modify label def highschool 1 "High school or higher", modify label values famempsingle famempsingle label def famempsingle 1 "Full time working", modify label def famempsingle 2 "Part time working", modify label def famempsingle 3 "Not working", modify
Comment