Announcement

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

  • Importance-Performance plot | help

    Hi,
    I am thinking about adapting the Importance-Performance Map Analysis (IPMA),

    Click image for larger version

Name:	1520086853878.jpg
Views:	1
Size:	41.3 KB
ID:	1775722

    where Yaxis would be the "mean" and Xaxis would the the coefficients(b).


    suppose this toy dataset:

    Code:
    . clear
    
    . use https://www.stata-press.com/data/r19/gsem_1fmm,clear
    (Single-factor pass/fail measurement model)
    
    . qui reg s4 x1 x2 x3 x4
    
    . mat li r(table)
    
    r(table)[9,5]
                   x1         x2         x3         x4      _cons
         b  25.260134  34.953102  29.649268   74.95344  627.76893
        se  10.128456  10.796608  8.9486418   11.95776  5.6094099
         t  2.4939767  3.2374152  3.3132702  6.2681841  111.91354
    pvalue  .01401691  .00156618  .00122472  6.190e-09  1.26e-121
        ll  5.2030331  13.572879  11.928521   51.27382  616.66077
        ul  45.317236  56.333325  47.370015  98.633059  638.87709
        df        118        118        118        118        118
      crit  1.9802722  1.9802722  1.9802722  1.9802722  1.9802722
     eform          0          0          0          0          0
    
    . qui estat summarize
    
    . mat li r(stats)
    
    r(stats)[5,4]
             mean         sd        min        max
    s4  690.98374  77.507375        481        885
    x1  .40650407  .49318966          0          1
    x2  .40650407  .49318966          0          1
    x3  .42276423  .49601907          0          1
    x4   .3495935  .47879185          0          1
    how to extract "mean" X "b" and scatter plot them ?? thanks.

  • #2
    Code:
    clear*
    
    use https://www.stata-press.com/data/r19/gsem_1fmm,clear
    
    reg s4 x1 x2 x3 x4
    
    matrix coeffs = r(table)
    matrix coeffs = coeffs["b", "x1".."x4"]
    matrix coeffs = coeffs'
    matrix list coeffs
    
    
    estat summarize
    
    mat li r(stats)
    matrix means = r(stats)
    matrix means = means["x1".."x4", "mean"]
    matrix list means
    
    matrix data = coeffs, means
    
    frame create for_ipma
    frame change for_ipma
    svmat data, names(col)
    graph twoway scatter mean b
    You can, of course, customize the appearance of the graph with various -twoway- options.

    Comment


    • #3
      Thanks Prof. Clyde,

      how difficult would be to include the name of the coefficients, in the "for_ipma" frame, in order to label the markes in the scatter? thks, again.

      Comment


      • #4
        Code:
        clear*
        
        use https://www.stata-press.com/data/r19/gsem_1fmm,clear
        
        reg s4 x1 x2 x3 x4
        
        matrix coeffs = r(table)
        matrix coeffs = coeffs["b", "x1".."x4"]
        matrix coeffs = coeffs'
        matrix list coeffs
        
        estat summarize
        
        mat li r(stats)
        matrix means = r(stats)
        matrix means = means["x1".."x4", "mean"]
        matrix list means
        
        matrix data = coeffs, means
        
        frame create for_ipma
        frame change for_ipma
        svmat data, names(col)
        
        local vbles: rownames data
        local n_rows: rowsof data
        gen vble = ""
        forvalues i = 1/`n_rows' {
            replace vble = `"`:word `i' of `vbles''"' in `i'
        }
        
        graph twoway scatter mean b, mlabpos(3) mlab(vble)

        Comment

        Working...
        X