Announcement

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

  • Graph for multiple rounds

    Hi everybody,
    This is my first post here

    Let me give you some information on my data set.
    For 15 rounds of my study, I have 15 variables for one treatment and 15 for the other, indicating if the player in that treatment was the player 1-2-3-4.

    Now, I want to see if player 1, in my case, both 1 and 3 (because they were matched), are predictive of that player's choice. So far, I get here:

    Code:
    forval i = 1/15 {
      gen P1_h`i' = (hd`i'groupid == 1 | hd`i'groupid == 3)
      gen P1_s`i' = (sh`i'groupid == 1 | sh`i'groupid == 3)
    }
    Where "male" is the choice variable (0/1).

    So, now I have 30 variables indicating if the subject was P1.

    Now, I would like to graph it by treatment, and I get here, but I'm stuck in an error:

    Code:
    preserve
    collapse (mean) choice_num, by("`P1_h'" "`P1_s'" block male treatment)
    twoway (connected choice_num block if "`P1_h'" == 1, sort msymbol(D) lpattern(l) by(treatment)) ///
           (connected choice_num block if "`P1_s'" == 1, sort msymbol(T) lpattern(dash) by(treatment)), ///
           legend() ///
           xscale(range (1 5)) ///
           xlabels(1(1)5) ///
           yscale(range (0 1)) ///
           ylabels(0(0.1)1) ///
           ytitle("")
    restore
    choice_num is the choice between A and B that the player perform (0/1)
    block is --> block = ceil(round / 3)

    Any help?

    Best
    Last edited by Federico Atzori; 25 Mar 2024, 11:15.
    HTML Code:
    <div style="font-family: Arial, sans-serif; font-size: 16px; color: #336699;"> <p style="margin: 0;">Analyzing economies with <strong>Federico Atzori, Economist Extraordinaire</strong> πŸ’ΌπŸ“ˆ</p> </div>
Working...
X