Announcement

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

  • ciplot

    I tried to use ciplot to plot two curves (var1 and var2) on the same graph. However, none of the mean points of these two curves (var1 and var2) line up with the labels (ticks) on the x-axis (var categorized into 5 groups). Can I get any help on that please? Thanks.

  • #2
    command used was: ciplot var1 var2, by (categorical var) c(l l 1 2) yaxis (2)

    Comment


    • #3
      ciplot is from SSC. The help says

      (note added August 2011)

      For fuller flexibility, consider using statsby first and then standard graphics commands (Cox 2010).

      ...

      Cox, N.J. 2010. Speaking Stata: The statsby strategy. Stata Journal 10: 143-151.
      So, it is a command no longer being developed. That said, I need to see a data example and real code please, as the code you cite is illegal.

      Comment


      • #4
        Graph produced from the command above. As can be seen, mean data points do not align with x-axis scale. Any help please?
        Attached Files

        Comment


        • #5
          You could, as the help that Nick quoted suggested, use standard graphing commands. Maybe something along these lines.
          Code:
          graph twoway ///
              rcap lbo ubo row, lcolor(black) || ///
                  connected o row, lcolor(black) mcolor(black) || ///
              rcap lbx ubx row, lcolor(black) || ///
                  connected x row, msymbol(X) msize(large) lcolor(black) mcolor(black) ////
                      ylabel( , format(%03.1f) angle(horizontal) nogrid) ytitle(Unknown logarithmically transformed stuff) ///
                      xtitle(Categories of unknown thingy) legend(off)

          Click image for larger version

Name:	Graph.png
Views:	1
Size:	32.6 KB
ID:	1669628

          Attached Files

          Comment


          • #6
            Frederick Asare The code you cite is illegal. by() needs a variable name and categorical var cannot be a variable name..

            Also, the FAQ Advice explains that .png attachments are requested for graphs, not .gph. Please see https://www.statalist.org/forums/help#stata

            ciplot displaces different intervals so that they can appear side by side. That is intended as a feature but is not what you want in your case.

            Joseph Coveney's helpful code rests on the assumption that what you want to plot is already present in variables. If you have yet to calculate the confidence intervals, my advice remains using statsby first. If you want help on that, please give a data example as explained in the link given earlier in this post.

            Comment


            • #7
              Thanks Nick and Joseph for your replies. Joseph this is exactly what I wanted to do and happy to see it work for me now. Thanks once again.

              Comment


              • #8
                Thanks Nick for all your useful information. Very well noted.

                Comment

                Working...
                X