Announcement

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

  • CI plot by year and group

    I would like to plot a CI mean difference, by two groups. However, when I run the following command:

    Code:
    ciplot cap_1, by(regime ano)
    I get this message: "by(): too many variables specified"

    Is there any other package to plot it?
    Attached Files

  • #2
    First of all, ciplot is from SSC. The help includes this note

    (note added August 2011) For fuller flexibility, consider using statsby first and then standard graphics commands

    So, that's the advice already given to you. For example.


    Code:
    . sysuse auto , clear
    (1978 Automobile Data)
    
    . statsby, by(foreign rep78) : ci mean mpg
    (running ci on estimation sample)
    
          command:  ci mean mpg
                N:  r(N)
             mean:  r(mean)
               se:  r(se)
               lb:  r(lb)
               ub:  r(ub)
            level:  r(level)
               by:  foreign rep78
    
    Statsby groups
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    ........
    
    . l
    
         +----------------------------------------------------------------------------+
         |  foreign   rep78    N       mean         se          lb         ub   level |
         |----------------------------------------------------------------------------|
      1. | Domestic       1    2         21          3   -17.11861   59.11861      95 |
      2. | Domestic       2    8     19.125   1.328768    15.98296   22.26704      95 |
      3. | Domestic       3   27         19   .7862783    17.38378   20.61622      95 |
      4. | Domestic       4    9   18.44444   1.528535    14.91964   21.96925      95 |
      5. | Domestic       5    2         32          2    6.587591   57.41241      95 |
         |----------------------------------------------------------------------------|
      6. |  Foreign       3    3   23.33333   1.452966    17.08172   29.58494      95 |
      7. |  Foreign       4    9   24.88889    .904379    22.80339   26.97439      95 |
      8. |  Foreign       5    9   26.33333   3.122499    19.13284   33.53383      95 |
         +----------------------------------------------------------------------------+
    and then you can plot the results as you wish. A search for mentions of ciplot on the forum will point up more detailed advice.
    Last edited by Nick Cox; 01 Apr 2021, 11:20.

    Comment


    • #3
      Thank you so much, Nick!

      Comment

      Working...
      X