Dear Stata Forum,
I would like to determine the marginal effects of the interaction terms
and graph them on the vertical axis and year on the horizontal axis.
The regression I am running is the following:
However, the margins command gives me an error message.
I would appreciate you help.
Here you find a data sample:
I would like to determine the marginal effects of the interaction terms
Code:
ib1998.year#c.logbite3
The regression I am running is the following:
Code:
regress self_c ib1998.year##c.logbite3
Code:
margins, dydx(c.logbite3) at(year(1993(1)2022))
I would appreciate you help.
Here you find a data sample:
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(self_c logbite3 year)
. . 1991
. . 1992
. . 1993
. . 1994
. . 1995
. . 1996
0 . 1997
0 -2.0409904 1998
0 -.7741088 1999
0 -.4291192 2000
0 -.6162011 2001
.2 -.6442134 2002
.25 -.40889165 2003
.3333333 -.7611812 2004
0 -1.2132735 2005
0 -1.0570409 2006
0 -1.248903 2007
0 -1.3217868 2008
.037037037 -1.3166054 2009
.05 -.7443178 2010
.0952381 -.7682025 2011
0 -.8468925 2012
.05 -.70977 2013
.071428575 -.7923768 2014
.0952381 -.74603 2015
.05 -.8348222 2016
.05263158 -.6987573 2017
0 -.6215868 2018
.07692308 -.6011775 2019
0 -.5080077 2020
0 -.419554 2021
0 -.4576086 2022
. . 1991
0 . 1992
0 -1.6483593 1993
0 -1.7577775 1994
0 -1.416572 1995
0 -1.7994494 1996
0 -1.833351 1997
.11111111 -1.7447444 1998
.125 -.6034867 1999
0 -.50562984 2000
0 -.4476819 2001
.3333333 -.54213685 2002
.3333333 -.9721524 2003
.3333333 -.8914877 2004
1 -1.2174888 2005
.3333333 . 2006
.3333333 -1.1037213 2007
1 -.9452747 2008
0 . 2009
0 -.5233285 2010
.15384616 -.3239966 2011
.0909091 -.4137999 2012
.08333334 -.3003126 2013
.037037037 -.31665915 2014
.04761905 -.437026 2015
.26086956 -.25689384 2016
.0909091 -.3406061 2017
.05 -.15568754 2018
.08 -.4489613 2019
.05555556 -.1754757 2020
.08695652 -.27745017 2021
0 -.27312517 2022
. . 1991
.0952381 . 1992
.08333334 -1.714637 1993
.08 -1.860475 1994
.0909091 -1.81326 1995
.08333334 -2.0264544 1996
.04545455 -1.948107 1997
0 -2.0730786 1998
0 -.6481928 1999
0 -.58449304 2000
0 -.4257042 2001
0 -.2682134 2002
0 -.3425188 2003
0 -.29530093 2004
0 -.4778255 2005
0 -.4895479 2006
0 -.3615529 2007
0 -.6257899 2008
.08333334 -.43232635 2009
.014492754 -.56207335 2010
.05714286 -.3648208 2011
.09756097 -.5524424 2012
.071428575 -.57270056 2013
.04878049 -.4556111 2014
.08333334 -.4946106 2015
.2051282 -.4723745 2016
.11538462 -.4804807 2017
.14285715 -.30491325 2018
.13333334 -.4541697 2019
.11111111 -.226769 2020
.071428575 -.307143 2021
0 -.2073963 2022
. . 1991
.03921569 . 1992
0 -1.7754605 1993
.04651163 -1.861579 1994
end

Comment