Announcement

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

  • cihplot

    I am working on a users written program called cihplot. When i run a plot of means and CIs of an outcome variable overtime. it plots outcome variables on x-axis and time variable on y axis where I want to plot these variables inversely
    cihplot outcome_var, by(time_var)

    I tried to edit but there seems no options.

    Any suggestion??

  • #2
    This is a program from SSC -- as you are asked to explain --

    12.1 What to say about your commands and your problem

    ...

    If you are using community-contributed (also known as user-written) commands, explain that and say where they came from: theStata Journal, SSC, or other archives. This helps (often crucially) in explaining your precise problem, and it alerts readers to commands that may be interesting or useful to them.

    Here are some examples:
    I am using xtreg in Stata 13.1.
    I am using estout from SSC in Stata 13.1.
    and it is from 1999:

    . ssc desc cihplot

    -----------------------------------------------------------------------------------
    package cihplot from http://fmwww.bc.edu/repec/bocode/c
    -----------------------------------------------------------------------------------

    TITLE
    'CIHPLOT': module to show horizontally labelled plots showing confidence
    intervals

    DESCRIPTION/AUTHOR(S)

    cihplot produces a display of means and confidence intervals for
    different variables, or for different groups of a single
    variable defined by the by option. ci is used for the
    calculations. hplot (from this archive) is used for the graphical
    display. This module supersedes hplotc. This is version 1.0.4 of
    the software.

    Author: Nicholas J. Cox, University of Durham
    Support: email [email protected]

    Distribution-Date: 19990603

    INSTALLATION FILES (type net install cihplot)
    cihplot.ado
    cihplot.hlp
    ../h/hplot.ado
    ../h/hplot.hlp
    -----------------------------------------------------------------------------------
    (type ssc install cihplot to install)


    The help file

    Code:
    help njc stuff
    -- also downloadable from SSC as part of the njc_stuff package -- documents that this is declared obsolete in view of ciplot (also SSC) and a note in

    Code:
    help ciplot
    from 2011 recommends prior use of
    Code:
    statsby
    any way. In turn that strategy is explained at

    SJ-10-1 gr0045 . . . . . . . . . . . . . Speaking Stata: The statsby strategy
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
    Q1/10 SJ 10(1):143--151 (no commands)
    demonstrates the use of statsby to prepare a reduced
    dataset for subsequent graphing


    with .pdf freely accessible at http://www.stata-journal.com/sjpdf.h...iclenum=gr0045

    You can find various wrapper programs to show confidence (or other) intervals, but my strong recommendation is a two-step:

    1. Use statsby as a framework to get a dataset of results.

    2. Use graph directly and get exactly what you want as you want, without having to accept or fight against someone's else defaults or different ideas about what's good.


    Here's a silly example to show how easy that can be.

    Code:
    sysuse auto, clear
    
    set scheme s1color
    
    statsby, by(rep78) : ci mean price
    
    * first graph
    twoway rcap lb ub rep78, horizontal lc(blue) || scatter rep78 mean, mc(blue) ///
    yla(1/5, valuelabel ang(h) noticks) xtitle("Price (USD)") legend(off)
    
    * second graph
    twoway rcap lb ub rep78, horizontal lc(blue) || scatter rep78 mean, mc(blue) ///
    yla(1/5, valuelabel ang(h) noticks) xtitle("Price (USD)") legend(off)  xsc(alt)
    I have two commands there as I'll explain after showing the graphs.
    Click image for larger version

Name:	cigraph1.png
Views:	1
Size:	16.8 KB
ID:	1436357



    Click image for larger version

Name:	cigraph2.png
Views:	1
Size:	16.7 KB
ID:	1436358




    Note that the wide intervals for repair record 1 are just a side-effect of being based only on 2 cars. They aren't in error.

    More interestingly and more generally:

    1. There aren't any value labels for rep78 in the auto datasetbut I put them in the syntax because in most substantial examples there are such value labels, or should be. Also, they look much better shown horizontally.

    2. The difference between the first and second graphs is that I put the x axis stuff at the top. For graphs with table flavour, I think this often looks good, but you make your own choices.

    Back to cihplot:

    * Why is it still accessible if it's not recommended? I see no need and no point in trying to decide for someone else what is of zero value. Conversely, I don't want to have to explain if someone asks about a program that the code is no longer accessible. It's easier and simpler all around just to document recommendations. (Conversely, not many programs support add-ons written just about 20 years ago, so good for Stata.)

    * Why can't you edit the graph? The program is version 6 and uses the old graph command. You can't edit such graphs in Stata 8 up. (20 or more years ago, there was a separate editor for old-style graphics.)

    * You say you want the inverse plot, presumably meaning vertical rather than horizontal. As cihplot is explicitly for horizontal plots it was the wrong choice any way. The example above is left because in most cases showing different categories with explanatory text is better done in that way. But changing the syntax is easy (graph not shown here):

    Code:
    twoway rcap lb ub rep78, lc(blue) || scatter mean rep78, mc(blue) ///
    xla(1/5, valuelabel ang(h) noticks) ytitle("Price (USD)") legend(off)  xsc(alt) name(G3)
    Last edited by Nick Cox; 27 Mar 2018, 03:49.

    Comment


    • #3
      Many thanks for a comprehensive reply

      Comment

      Working...
      X