| 1 | <html><h1>errbar1</h1><img src="errbar1.gif"><p> |
| 2 | <a href="gall.using.html">How to download and try this example</a><br> |
| 3 | |
| 4 | <pre><b>Usage: pl -gif errbar1.htm |
| 5 | or for postscript: pl -ps errbar1.htm | lp |
| 6 | |
| 7 | In this example the means and standard deviations were already calculated, |
| 8 | so proc bars is used to render the bars. An alternative is to use proc |
| 9 | rangebar with meanmode option to calculate mean & standard deviation |
| 10 | and render bars. |
| 11 | |
| 12 | Categories are used to position bars in X; proc catslide is used to |
| 13 | adjust the positioning slightly so that pairs of bars may be displayed |
| 14 | for each category. |
| 15 | <hr></b> |
| 16 | |
| 17 | #set TAILLEN = 0.05 |
| 18 | |
| 19 | #proc Page: |
| 20 | pagesize: 8.5 11 |
| 21 | #if @DEVICE in gif,png |
| 22 | scale: 0.4 |
| 23 | #endif |
| 24 | Title: Mean FES Scores |
| 25 | For Families in Emergency Shelters vs. |
| 26 | Families in Transitional Housing |
| 27 | |
| 28 | ///////////////////////////// |
| 29 | ////// Top Panel |
| 30 | ///////////////////////////// |
| 31 | |
| 32 | |
| 33 | ///////// Left bars |
| 34 | |
| 35 | // specify data for top panel, left of each pair |
| 36 | // (must be done before areadef because areadef uses data to set up category names) |
| 37 | #Proc Getdata: |
| 38 | Data: |
| 39 | // E (1-5) |
| 40 | //categ n obs mean stdev pval |
| 41 | //==== ===== ===== ===== ===== |
| 42 | coh 23 37.83 18.66 p<.05 |
| 43 | exp 23 42.17 9.00 p<.05 |
| 44 | conf 23 54.48 13.67 p>.05 |
| 45 | ind 23 42.52 14.71 p>.05 |
| 46 | achiev 23 54.48 8.44 p>.05 |
| 47 | |
| 48 | // set up plot area |
| 49 | #Proc Areadef: |
| 50 | areaname: 2hi |
| 51 | xscaletype: categories |
| 52 | xcategories: datafield=1 |
| 53 | yrange: 0 100 |
| 54 | Xaxis.stubs: text |
| 55 | Cohesion |
| 56 | Expressiveness |
| 57 | Conflict |
| 58 | Independence |
| 59 | Achievement\nOrientation |
| 60 | |
| 61 | yaxis.stubs: inc 10 |
| 62 | Yaxis.label: Standard Score |
| 63 | |
| 64 | |
| 65 | // do horizontal lines.. |
| 66 | #Proc Line |
| 67 | linedetails: width=0.4 dashscale=5 |
| 68 | notation: locval |
| 69 | points: min 50(s) max 50(s) |
| 70 | |
| 71 | #Proc Line |
| 72 | linedetails: width=0.4 dashscale=5 style=1 |
| 73 | notation: locval |
| 74 | Points: min 40(s) max 40(s) |
| 75 | min 60(s) max 60(s) |
| 76 | |
| 77 | // do centered p values |
| 78 | #Proc Scatterplot |
| 79 | Xfield: 1 |
| 80 | ylocation: 5(s) |
| 81 | labelfield: 5 |
| 82 | |
| 83 | // prepare to do left bars |
| 84 | #proc catslide |
| 85 | axis: x |
| 86 | amount: -0.1 |
| 87 | |
| 88 | // render points |
| 89 | #Proc Scatterplot: |
| 90 | Xfield: 1 |
| 91 | Yfield: 3 |
| 92 | symbol: shape=pixdiamond style=solid color=black radius=0.05 |
| 93 | |
| 94 | // render bars |
| 95 | #Proc bars |
| 96 | locfield: 1 |
| 97 | lenfield: 3 |
| 98 | errbarfields: 4 |
| 99 | tails: @TAILLEN |
| 100 | |
| 101 | ////////// Right bars //////////////// |
| 102 | |
| 103 | // prepare to do right bars |
| 104 | #proc catslide |
| 105 | axis: x |
| 106 | amount: 0.1 |
| 107 | |
| 108 | // specify data for right bars |
| 109 | #Proc Getdata: |
| 110 | // T (1-5) |
| 111 | // cat n obs mean stdev |
| 112 | //===== ===== ===== ===== |
| 113 | Data: |
| 114 | coh 39 52.38 15.44 |
| 115 | exp 39 48.90 8.94 |
| 116 | conf 39 50.90 10.99 |
| 117 | ind 39 44.62 9.59 |
| 118 | achiev 39 54.92 8.59 |
| 119 | |
| 120 | // render points |
| 121 | #Proc Scatterplot: |
| 122 | Xfield: 1 |
| 123 | Yfield: 3 |
| 124 | symbol: shape=pixsquare style=solid color=black radius=0.05 |
| 125 | |
| 126 | // render bars |
| 127 | #proc bars |
| 128 | locfield: 1 |
| 129 | lenfield: 3 |
| 130 | errbarfields: 4 |
| 131 | tails: @TAILLEN |
| 132 | |
| 133 | |
| 134 | ///////////////////////////////////////////////// |
| 135 | //// Bottom row |
| 136 | ///////////////////////////////////////////////// |
| 137 | |
| 138 | // specify data for left bars |
| 139 | #proc getdata: |
| 140 | // E (6-10) |
| 141 | //cat n obs mean stdev pval |
| 142 | //===== ===== ===== ===== ===== |
| 143 | data: |
| 144 | int 23 45.78 14.30 p<.05 |
| 145 | act 23 45.00 12.30 p>.05 |
| 146 | mor 23 53.26 9.11 p<.05 |
| 147 | org 23 49.17 10.43 p<.05 |
| 148 | con 23 59.48 10.40 p>.05 |
| 149 | |
| 150 | #proc areadef: |
| 151 | areaname: 2lo |
| 152 | xscaletype: categories |
| 153 | xcategories: datafield 1 |
| 154 | yrange: 0 100 |
| 155 | |
| 156 | #proc xaxis |
| 157 | stubs text |
| 158 | Intellectual-\nCultural\nOrientation |
| 159 | Active-\nRecreational\nOrientation |
| 160 | Moral-\nReligious\nEmphasis |
| 161 | Organization |
| 162 | Control |
| 163 | |
| 164 | #proc yaxis |
| 165 | stubs: inc 10 |
| 166 | label: Standard Score |
| 167 | |
| 168 | // do horiz. lines |
| 169 | #Proc line |
| 170 | notation: locvalues |
| 171 | linedetails: width=0.4 |
| 172 | Points: min 50(s) max 50(s) |
| 173 | |
| 174 | #proc line: |
| 175 | notation: locvalues |
| 176 | linedetails: style=1 dashscale=5 width=0.4 |
| 177 | Points: min 40(s) max 40(s) |
| 178 | min 60(s) max 60(s) |
| 179 | |
| 180 | // do centered P values |
| 181 | #Proc Scatterplot |
| 182 | Xfield: 1 |
| 183 | ylocation: 5(s) |
| 184 | labelfield: 5 |
| 185 | |
| 186 | #proc catslide |
| 187 | axis: X |
| 188 | amount: -0.1 |
| 189 | |
| 190 | // render points |
| 191 | #Proc Scatterplot: |
| 192 | Xfield: 1 |
| 193 | Yfield: 3 |
| 194 | symbol: shape=pixdiamond style=solid color=black radius=0.05 |
| 195 | |
| 196 | // render bars |
| 197 | #Proc bars |
| 198 | locfield: 1 |
| 199 | lenfield: 3 |
| 200 | errbarfields: 4 |
| 201 | tails: @TAILLEN |
| 202 | |
| 203 | |
| 204 | //////////// Right bars |
| 205 | |
| 206 | #proc catslide |
| 207 | axis: x |
| 208 | amount: 0.1 |
| 209 | |
| 210 | #proc getdata: |
| 211 | // T (6-10) |
| 212 | // cat n obs mean stdev |
| 213 | //==== ===== ===== ===== |
| 214 | Data: |
| 215 | int 39 53.51 9.78 |
| 216 | act 39 47.54 11.50 |
| 217 | mor 39 58.67 6.34 |
| 218 | org 39 55.33 9.86 |
| 219 | con 39 56.31 8.97 |
| 220 | |
| 221 | // render points |
| 222 | #Proc Scatterplot: |
| 223 | Xfield: 1 |
| 224 | Yfield: 3 |
| 225 | symbol: shape=pixsquare style=solid color=black radius=0.05 |
| 226 | |
| 227 | // render bars |
| 228 | #proc bars |
| 229 | locfield: 1 |
| 230 | lenfield: 3 |
| 231 | errbarfields: 4 |
| 232 | tails: @TAILLEN |
| 233 | |
| 234 | // Define legend entries explicitly |
| 235 | #proc legendentry |
| 236 | sampletype: symbol |
| 237 | label: Emergency Shelters (N = 23) |
| 238 | details: shape=diamond style=filled fillcolor=black radius=0.05 |
| 239 | |
| 240 | #proc legendentry |
| 241 | sampletype: symbol |
| 242 | label: Transitional Housing (N = 39) |
| 243 | details: shape=square style=filled fillcolor=black radius=0.05 |
| 244 | |
| 245 | #proc legend: |
| 246 | location: 5.5 9 |