Announcement

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

  • #31
    Splendid! My bad, at least I should have seen that } was to be below the post handle line and above the postclose handle. I did just that and got the plot.

    Code:
    capture postutil clear
    tempfile results
    postfile handle int percentile float bx5 lb ub using `results'
    
    forvalues i = 5 (5) 95 {
        qreg2 y x1 x2 x3 x4 x5 x6 x7 y2 - y5 if wanted1==5, cluster(unit) wlsiter(60) q(`=`i'/100')
    
    matrix M = r(table)
    post handle (`i') (M[1, 5]) (M[5,5]) (M[6,5])
    }
    postclose handle
    xtreg y x1 x2 x3 x4 x5 x6 x7 y2 - y5 if wanted1==5, cluster(unit) re
    local x5 = _b[x5]
    matrix M = r(table)
    local lb = M[5,5]
    local ub = M[6,5]
    
    use `results', clear
    
    label var bx5 "x5 coefficient"
    label var lb "lower limits"
    label var ub "upper limits"
    
    graph twoway connect bx5 lb ub percentile, sort ///
        yline(`x5' `lb' `ub')
    Thank you very much for your time, energy and assistance.

    Cobby.

    Comment


    • #32
      Hello I am using this code to plot the coefficient after quantile regression. Can someone help me how to plot multiple coefficients after running the regression.

      code
      tempfile holding
      postfile handle quantile coefficient se using `holding'

      forvalues i=1(1)9{
      local ii=`i'/10
      qregpd gdppc gdppc_lag fdi poplog hc afdi afdi_fdi,quantile(0.5) id(countrycode) fix(yearavg5) optimize(mcmc) noisy draws(1000) burn(100) arate(.5)
      post handle (`ii') (_b[fdi]) (_se[fdi])
      }
      postclose handle
      use `holding', clear
      gen lb=coefficient-se*1.65
      gen ub=coefficient+se*1.65
      graph twoway (rarea lb ub quantile) || (line coefficient quantile)



      Comment

      Working...
      X