Announcement

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

  • Creating graphs with scalar variables

    I am having trouble difficulty creating a graph using scalar variables stored from stata (found by entering return list, or ereturn list). I know the common commands are to create them as locals or scalars, but I still cannot get my code to run. Any help please? Here in my code, "visit" is my third variable, which is essentially a time component that will run along my x-axis. The two scatter plot scalar variables I am trying to use should be obvious. I've tried many variations of this, creating locals or scalars.

    Thank you!

    Code:
    scalar ci = r(CI)
    scalar cise = r(CIse) 
    twoway scatter `=scalar(ci)' `=scalar(cise)' visit, sort

  • #2
    It's not obvious to me what you want to do. Which command did you run to get those returned results? You won't get a scatter out of

    scatter <number> <number> <variable>

    as scatter needs variable names. There will be a way to do what you want, but you have to back up and tell us what it is. I guess you want separate confidence intervals for different categories but your syntax is a long way from that.

    Comment


    • #3
      Hi, thank you for response. I am absolutely no graphing expert. I am working with concentration curves, and concentration indices. I am trying to form graphs, over time (x-axis), graphing the outcomes of the concentration indices. If you look at help conindex, the code I am using, the saved results I would like to graph, over time, are the Index results and the Standard Errors, r(CI) and r(CIse) - and I have these for four groups I would like to compare.

      I have been reading about different ways to set things as scalars, or locals .... basically nothing has worked.

      Page 4 of the attached paper has a nice graph, although it does not incorporate the standard errors. Thank you!!

      Attached Files

      Comment


      • #4
        I am not previously familiar with conindex.

        I'd give a data example, the conindex call you sued, and show us the results of return list afterwards.

        I tried to run the example file distributed with conindex but gave up.

        Code:
        . do conindex_example
        
        . **************************************
        . * Data
        . **************************************
        . * The data used in the examples can be downloaded after registration from The DHS Pr
        > ogram website: 
        . * http://www.dhsprogram.com/data/dataset_admin/login_main.cfm?logout=&CFID=8679569&C
        > FTOKEN=40f990b41b421b7e-9C675AF9-9325-ECB7-18E9AA5A272CE050 .
        . 
        . **************************************
        . * Indices in Table 1 for healthexp:
        . **************************************
        . use "CDHS2010hh.dta", clear
        file CDHS2010hh.dta not found
        r(601);
        The program authors may be willing to advise.

        Comment


        • #5
          Ok, thanks. Alternatively, would you be willing to help show me how to set up a really simple graph of any sort - sysuse auto, for example, where a basic graph is created from results of anything from the return list? I think even getting past that hurdle I could sort it. (And then repost once I do!)

          I have just struggled with the local/macro ` ' or `=' language, in getting any kind of graph to run when using two return list variables for a graph. It doesn't have to be specific to conindex.

          Comment


          • #6
            I am shortly travelling, so I leave this open. Frankly, that's expecting the other person who answers to do almost all the work.

            Comment


            • #7
              Sorry, was not my intention!! I will post when I solve it.

              Comment

              Working...
              X