Announcement

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

  • Event study

    Hi,
    I'm a new in Stata so I apologize for stupid questions
    I'm trying to run an event study and the coefficient plotting vertically instead of horizontally. I have been trying to adjust my codes but still doesn't work. Here are the codes and the graph
    coefplot EventStudyModel, keep(event_m5 event_m4 event_m3 event_m2 event_m1 event_p0 event_p1 event_p2 event_p3 event_p4 event_p5) rename(event_m5="-5" event_m4="-4" event_m3="-3" event_m2="-2" event_m1="-1" event_p0="0" event_p1="1" event_p2="2" event_p3="3" event_p4="4" event_p5="5") xlabel(-5(1)5, labsize(medium)) xline(0) drop(_cons) ylabel(, angle(0)) title("Event Study: Impact of Tax on Avg Price per ml") horizontal.
    See less

  • #2
    Hi Norah, welcome to the forum. So you are trying to make a coefficient plot for an event study and you are using the -coefplot- community contributed command? You've tried the following code:

    Code:
    coefplot EventStudyModel, keep(event_m5 event_m4 event_m3 event_m2 event_m1 event_p0 event_p1 event_p2 event_p3 event_p4 event_p5) ///
        rename(event_m5="-5" event_m4="-4" event_m3="-3" event_m2="-2" event_m1="-1" event_p0="0" event_p1="1" event_p2="2" event_p3="3" event_p4="4" event_p5="5") ///
        xlabel(-5(1)5, labsize(medium)) xline(0) drop(_cons) ylabel(, angle(0)) title("Event Study: Impact of Tax on Avg Price per ml") horizontal
    You say the code "does not work." What does it do? Does it produce an error message, and if so, which one? Does it produce a plot that does not look correct, and if so, in what way does it look incorrect?

    Your question isn't stupid (it's a fairly typical ask) but the way you ask could use some work. For example, we generally also ask users to provide a small data example using the -dataex- command. The command is easy to use and will allow us to work with your code on our end. I'd strongly recommend you read the FAQ linked at the top for more advice on good posting. If you post poorly explained code without proper formatting (be sure to use code blocks marked with the # symbol in the editor for code) or a data example, or the error message, chances are high that you will not get a response, let alone an answer.

    Comment


    • #3
      Thank you, Daniel for your response. Yes, I'm trying to make a coefficient plot for an event study and the code is working and I have the plot. The issue here, the coefficient is showing vertically in the graph instead of a normal an event graph (horizontally).

      Comment


      • #4
        It sounds like you want coefficient labels on the x-axis. If you look at the documentation for the horizontal option it says:

        coefficient values are on x axis
        If the values are on the x axis the labels will be on the y axis. Seems like you might want the vertical option instead. Obviously I can't reproduce your figure without a data example, but here is a minimal example:

        Code:
        sysuse auto
        regress mpg weight displacement gear_ratio i.foreign
        coefplot, vertical

        Comment


        • #5
          Thanks, Daniel. It works.

          Comment

          Working...
          X