Announcement

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

  • Coefplot

    Hey all. I have a question regarding coefplot. I am running a panel regression xtreg with a set of country fixed-effects, time fixed-effects as well as a set of election-event-dummies. Policy is a measure for the harshness of the implemented policies, here school closures. Election-event dummies are named election_term_minus_67 ... election_term ... election_term_plus_13 taking the value 1 if the month corresponds the respective month in the electoral cycle, i.e. like this for every country.
    ...
    ...
    March // Policy-value // no election // election_term_minus_1 = 1 // election_term = 0 // election_term_plus_1 = 0 // n_month_election_term= -1
    April // Policy-value // election // election_term_minus_0 = 1 // election_term = 1 // election_term_plus_1 = 0 / / n_month_election_term=0
    Mai // Policy-value // no election // election_term_minus_1 = 0 // election_term = 0 // election_term_plus_1 = 1 // n_month_election_term=1
    ...
    ...

    I run:

    Code:
    eststo school: xtreg policy election_term_* i.country_id i.month_number
    
    coefplot (school, keep(election_term_*)), vertical yline(0, lpattern(_) lcolor(red)) msymbol(O) mlcolor(gs11) mfcolor(gs11) ciopts(recast(rcap) lcolor(gs11)) title("Election effect over time") legend(off) nooffsets coeflabels(, labsize(tiny) alternate)

    What I get is this (see below). However, I would prefer having only a bunch of variables on the axis so that numbers are bigger, e.g. all 6 months.

    I've tried other methods such as xlabel(-67(6)13) but then it only begins to plot the coefficients from the start of the positive values while all negative numbers are blank.

    I initially also just wanted to do regular dummies with the variable that contains the distance to the next election, i.e. i.n_month_election_term but this is not possible as factor variables must not be negative, so I created dummies by myself and labeled them accordingly with the number only.

    Many thanks for any comment on this xD

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	106.8 KB
ID:	1597354


  • #2
    coefplot is from the Stata Journal (FAQ Advice #12). You are getting confused by your labels. They do not coincide with the actual axis values as the first coefficient in the x-axis by default is at x=1. So you want

    Code:
    , xlab(1 6(6)100)
    Last edited by Andrew Musau; 11 Mar 2021, 11:07.

    Comment


    • #3
      ok. thanks. however, i want exactelly this range in the x-axis. meanwhile, i found another solution by myself which gives me full flexibility over the axis including negative values: https://stackoverflow.com/questions/...udy-graph-code

      Comment

      Working...
      X