Announcement

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

  • #16
    Excuse me@ Fei Wang if I wanted to write instead of "2015", "2016", "2017" and "2018" but "Mar.-May 2020", "June-Sept 2020", "Oct-Dec 2020","Jan 2021-last month available" what should i write?
    i tried the code below but it gives me error. Where is the error?


    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Years SMR CI_lb CI_ub REFERENCE)
    "Mar.-May 2020" 1.14  .49 2.25 1
    "June-Sept 2020" 1.39  .74 2.38 1
    "Oct-Dec 2020" 1.57  .78 2.81 1
    "Jan 2021-last month available" 1.87 1.17 2.84 1
    end
    
    
    twoway connected SMR Years || rcap CI_lb CI_ub Years, yline(1)
    ------------------ copy up to and including the previous line ------------------



    Thanks a million

    Comment


    • #17
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str50 Years float(SMR CI_lb CI_ub REFERENCE)
      "Mar.-May 2020" 1.14  .49 2.25 1
      "June-Sept 2020" 1.39  .74 2.38 1
      "Oct-Dec 2020" 1.57  .78 2.81 1
      "Jan 2021-last month available" 1.87 1.17 2.84 1
      end
      
      gen time = _n
      forvalues i = 1/`=_N' {
          local l = Years[`i']
          lab define t `i' `"`l'"', modify
      }
      lab val time t
      
      twoway connected SMR time || rcap CI_lb CI_ub time, yline(1) xlab(,val)
      Last edited by Fei Wang; 11 Nov 2021, 08:49.

      Comment


      • #18
        Fei Wang thanks a lot

        Comment


        • #19
          Sorry Fei Wang
          Period SMR 1 IC95% SMR 2 IC95% SMR 3 IC95% SMR4 IC95%
          Mar.-May 2020 0.71 (0.63-0.80) 0.74 (0.62-0.88) 0.00 (0.00-1.21) 0.47 (0.29-0.70)
          June-Sept 2020 0.95 (0.87-1.04) 0.85 (0.74-0.98) 1.97 (0.85-3.88) 0.88 (0.67-1.14)
          Oct-Dec 2020 0.91 (0.81-1.01) 1.17 (1.02-1.34) 0.98 (0.20-2.87) 0.75 (0.53-1.03)
          Jan 2021-last month available 0.82 (0.76-0.88) 1.15 (1.05-1.26) 0.72 (0.23-1.67) 0.76 (0.61-0.94)
          Forgive me if I get upset but if I wanted to insert all 4 values ​​in a single graph? HOW COULD I DO?

          Comment


          • #20
            Just add more lines in a similar way. Something like:

            Code:
            twoway connected SMR1 time || rcap CI_lb1 CI_ub1 time || connected SMR2 time || rcap CI_lb2 CI_ub2 time || connected SMR3 time || rcap CI_lb3 CI_ub3 time || connected SMR4 time || rcap CI_lb4 CI_ub4 time, yline(1) xlab(,val)
            Add more columns (storing other SMRs and upper/lower bounds of CIs) to the example data in #17 before running the code above.

            Comment


            • #21
              @ Thanks A million

              Comment


              • #22

                Excuse me Fei Wang if I'm pedantic but it's for the thesis. To make the lines of the 4 smr, of 4 different colors and the points that connect the lines of the same shape how to do? Infinitely thank you

                Comment


                • #23
                  Frankly, I'm not good at graphing with Stata. #20 just did the basic job and should look ugly. I usually plot via menu bar and dialog box of Stata (you may try this), and then copy and paste the (usually long) code to my do file. Sorry can't help more on this.

                  Comment

                  Working...
                  X