Announcement

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

  • Manually Create Graphs (using coef and standard error)

    Dear All,

    I hope you are doing very well.

    I need some help as I would like to manually create a coefplot out of my data, considering that my data is constituted by the variables: Time, Coefficient, Std. err., z, P>z (pvalue), 95% conf. interval -- low, and 95% conf. interval -- high.

    My Y axis should be the coefficient, and my X axis the time variable. I also would like to add mlabels to each coefficient point with significance stars (* P ≤ 0.1; ** P ≤ 0.05; *** P ≤ 0.01).

    Is this possible to do?


    Here is what my dataset looks like
    Code:
    time  coefficient  std_err    z_stat  pvalue   ci95_low    .ci95_high
    
    1      -.0245       .0208597    -1.17   0.240    -.0653842    .0163842
    2        .007       .0007071     9.90   0.000     .0056141    .0083859
    3        .014       .0106125     1.32   0.187    -.0068001    .0348001
    4      .00575      .039004     0.15   0.883    -.0706964    .0821964
    5      -.0145     .0183504    -0.79   0.429    -.0504661    .0214661
    6       .0045     .0053794     0.84   0.403    -.0060433    .0150433
    7   -.0341667   .0307992    -1.11   0.267    -.0945319    .0261986
    8       .0095     .0084595     1.12   0.261    -.0070802    .0260802
    9    -.013575     .0126924    -1.07   0.285    -.0384517    .0113017
    10     -.00974     .0101287    -0.96   0.336    -.0295918    .0101118
    11      .01745     .0135724     1.29   0.199    -.0091515    .0440515
    12     -.00085     .0132536    -0.06   0.949    -.0268266    .0251266
    Thank you so much in advance.

    Cat



  • #2
    lgraph would work.

    Comment


    • #3
      you could scatter the coefficients and rarea the CI.

      Comment


      • #4
        Code:
        clear
        input time  coefficient  std_err    z_stat  pvalue   ci95_low    ci95_high
        1      -.0245       .0208597    -1.17   0.240    -.0653842    .0163842
        2        .007       .0007071     9.90   0.000     .0056141    .0083859
        3        .014       .0106125     1.32   0.187    -.0068001    .0348001
        4      .00575      .039004     0.15   0.883    -.0706964    .0821964
        5      -.0145     .0183504    -0.79   0.429    -.0504661    .0214661
        6       .0045     .0053794     0.84   0.403    -.0060433    .0150433
        7   -.0341667   .0307992    -1.11   0.267    -.0945319    .0261986
        8       .0095     .0084595     1.12   0.261    -.0070802    .0260802
        9    -.013575     .0126924    -1.07   0.285    -.0384517    .0113017
        10     -.00974     .0101287    -0.96   0.336    -.0295918    .0101118
        11      .01745     .0135724     1.29   0.199    -.0091515    .0440515
        12     -.00085     .0132536    -0.06   0.949    -.0268266    .0251266
        end
        
        gen str3 star = "*"   if pvalue <= 0.1  & pvalue > 0.05
        replace  star = "**"  if pvalue <= 0.05 & pvalue > 0.01
        replace  star = "***" if pvalue <= 0.01
        
        twoway scatter coefficient time, mlabel(star)
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Code:
          g str3 star = (cond(pvalue<.01, "***", cond(pvalue<.05, "**", cond(pvalue<.10, "*", ""))))

          Comment


          • #6
            Code:
            twoway connected coefficient time , yline(0) || rarea ci95_low ci95_high time, color(gs10%50)

            Comment


            • #7
              Dear George Ford and Maarten Buis, thank you so much for your help! Appreciate it!

              Comment

              Working...
              X