Announcement

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

  • Smr - observed and expected


    What is the best way to show the difference between observed and expected in graphic form? I USE the code istdize...

  • #2
    thanks to everybody

    Comment


    • #3
      Good morning Nick Cox
      I use this instruction to calculate SMR :

      istdize casevar_s popvar_s stratavars [if] [in] using filename, {popvars(casevar_p popvar_p) |
      rate(ratevar_p {#|crudevar_p})} [istdize_options]



      What is the best way to underline graphically the difference between observed and expected???

      Is there an instruction in STATA?

      Thank you so much!!! Tommaso

      Comment


      • #4
        I didn't understand your exact problem before, and pinging me directly doesn't make a difference. Sorry.

        Comment


        • #5
          Providing data using -dataex- (as suggested in the FAQ) will make it much easier to answer. It's not possible to answer using the information you have provided. Often the SMR is just two numbers (observed (plus SE) and expected (a fixed constant)) so graphing them would seem redundant. Since you are asking, I would assume you have calculated SMRs for various subgroups, but the answer to your question depends on the subgroups (how many variables, how many categories, ordinal or nominal, etc.).

          Comment


          • #6
            ----------------------- copy starting from the next line -----------------------
            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input byte Regione str5 Age_class long POP int(VAR1 VAR2) byte VAR3 int VAR4
             1 "0-17"   280836   69  30  0   7
             1 "18-25"  136905   45  27  5   8
             2 "0-17"  3019494  520 197  1  69
             2 "18-25" 1622964   76  89  5  37
             3 "0-17"  2086140  426 150  5  74
             3 "18-25"  971445  115 265 23  40
             4 "0-17"  2739450  677 222  5 111
             4 "18-25" 1302687  105 209 10  23
             5 "0-17"  1643196  359 204  3  37
             5 "18-25"  790824   67 198 13  20
             6 "0-17"    58668   12   5  0   2
             6 "18-25"   28338    2  11  4   0
             7 "0-17"  4878294 1094 607 18 173
             7 "18-25" 2299572  213 577 44  63
             8 "0-17"  2443581  833 263  2  76
             8 "18-25" 1297545  137 198  1  27
             9 "0-17"  1918566  300 112  2  43
             9 "18-25"  946779   49 267 13  18
            10 "0-17"   301197   48  41  4  14
            10 "18-25"  145536   19  42  7   7
            11 "0-17"   614661  173  71  0  25
            11 "18-25"  318915   26 127  9   9
            end
            ------------------ copy up to and including the previous line ------------------

            Fisrt of all thanks Paul Dickman
            Yes, i ve calculated SMR for 2 subgruops (class age 0-17 and class age 18-25)...

            Can you help me?

            Thanks to everybody

            Comment


            • #7
              Thanks for providing the data, but those data don't give the observed and expected.

              Before going any further, I think it's worth clarifying your question.

              What is the best way to underline graphically the difference between observed and expected???
              If I understand correctly, you have the observed and expected for two group and are asking (class age 0-17 and class age 18-25) what is the best way to graph four numbers. If that's what you're asking then I think others are more qualified to answer as I am not an expert in Stata graphs and I don't think a graph is motivated for such a problem.

              I did actually try and give you a solution using the example from the help.

              Code:
              webuse kahn, clear
              istdize death pop age using https://www.stata-press.com/data/r17/popkahn, by(state) pop(deaths pop) print
              That example is very similar (it calculates the SMR for two states rather than two age groups) but there is no -save- option so the values would need to be extracted from r().

              Comment


              • #8
                Good morning Paul Dickman I was asking what you've said.
                thanks anyway.. best Tommaso

                Comment


                • #9
                  If you provide the data, then I'm someone might show you a graph, but it's not obvious what you want because there are not that many ways to plot 4 numbers. The obvious way is a scatter plot with 4 points. Do you need help in producing such a plot? Or are you thinking of something else? If so, what? Do you want error bars around the observed?

                  Comment


                  • #10
                    Good morning Paul Dickman i have to graph these things:
                    Years SMR IC 95% REFERENCE
                    2015 1.14 (0.49-2.25) 1
                    2016 1.39 (0.74-2.38) 1
                    2017 1.57 (0.78-2.81) 1
                    2018 1.87 (1.17-2.84) 1
                    on the x-axis i ve to put the year, in yhe y-axis I ve to put SMR (and Ic 95%) . i ve to do a line graph... i don't know how to graph IC cAN YOU HELP ME.. Thanks a lot Have a nice day Tom Salvitti

                    Comment


                    • #11
                      To #10:

                      Code:
                      * Example generated by -dataex-. For more info, type help dataex
                      clear
                      input float(Years SMR CI_lb CI_ub REFERENCE)
                      2015 1.14  .49 2.25 1
                      2016 1.39  .74 2.38 1
                      2017 1.57  .78 2.81 1
                      2018 1.87 1.17 2.84 1
                      end
                      
                      twoway connected SMR Years || rcap CI_lb CI_ub Years

                      Comment


                      • #12
                        Thank you very much Fei Wang .
                        how to insert "reference line" 1 parallel to the x axis?

                        Comment


                        • #13
                          Originally posted by Tom Salvitti View Post
                          Thank you very much Fei Wang .
                          how to insert "reference line" 1 parallel to the x axis?
                          Code:
                          twoway line SMR Years || rcap CI_lb CI_ub Years, yline(1)

                          Comment


                          • #14
                            thank youso much... Fei Wang

                            Comment


                            • #15

                              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?

                              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)

                              Comment

                              Working...
                              X