1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
|
.ig >>
<STYLE TYPE="text/css">
<!--
A:link{text-decoration:none}
A:visited{text-decoration:none}
A:active{text-decoration:none}
OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }
H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>ploticus: proc curvefit</title>
<body bgcolor=D0D0EE vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550><tr>
<td>
<table cellpadding=2 width=550><tr>
<td><br><h2>proc curvefit</h2></td>
<td align=right>
<small>
<a href="../doc/welcome.html"><img src="../doc/ploticus.gif" border=0></a><br>
Version 2.33 Jun'06
</small><br><a href="../doc/scripthome.html">Scripts</a>
<td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>
.TH proc_curvefit PL "02-JUN-2006 PL ploticus.sourceforge.net"
.ig >>
<center>
<img src="../gallery/curvefit3.gif">
</center>
.>>
.LP
\fBproc curvefit\fR uses the
.ig >>
<a href="dataformat.html#currentds">
.>>
\0current data set
.ig >>
</a>
.>>
to compute a curve which it then renders in the
.ig >>
<a href="areadef.html">
.>>
\0current plotting area.
.ig >>
</a>
.>>
Available curve types are: moving average, average, linear regression, bspline, and interpolated curves.
Typical uses are to clarify overall trends in the data, or for smoothing.
(If you just want to draw a line connecting your data points, without any smoothing, use
.ig >>
<a href="lineplot.html">
.>>
\0proc lineplot.)
.ig >>
</a>
.>>
The data do not have to be in X order.. they will be sorted on X as part of the process
(except with the interpolated curve type). See also the
.ig >>
<a href="../gallery/gall.curvefit.html">
.>>
\0gallery curvefit examples.
.ig >>
</a>
.>>
.LP
Limitations:
The maximum number of input points for a bspline curve is 100.
The default maxiumum number of input points for all other curve types
is 1000.. to raise this limit use the proc curvefit attribute \fCmaxinpoints\fR.
Generated curve points are placed into the plotting vector; its size can
be controlled using command line argument \fC-maxvect\fR.
.ig >>
<br><br><br>
.>>
.SH Attributes
The \fCyfield\fR attribute MUST be specified.
.LP
\fByfield\fR
.ig >>
.>>
.ig >>
<a href="attributetypes.html#dfield">
.>>
\0dfield
.ig >>
</a>
.>>
.IP \0
Data field to use for Y values. Example: \fCyfield: 1\fR
.ig >>
<br><br>
.>>
.LP
\fBxfield\fR
.ig >>
.>>
.ig >>
<a href="attributetypes.html#dfield">
.>>
\0dfield
.ig >>
</a>
.>>
.IP \0
Data field to use for X values.
If not given, sequential unit locations in X will be used.
Example: \fCxfield: 4\fR
.ig >>
<br><br>
.>>
.LP
\fBcurvetype\fR
.ig >>
.>>
\fCmovingavg\fR | \fCregression\fR | \fCbspline\fR | \fCavg\fR | \fCinterpolated\fR
.IP \0
The type of curve fitting computation to perform.
.IP \0
\fBmovingavg\fR - for each point, it takes the average of the current point and \fIn\fR-1
points to the left (or as many points as are available).
\fIn\fR is controlled by the \fCorder\fR attribute.
Often used in finance.
.IP \0
\fBregression\fR - Computes the linear regression for the set of points. The result will be a
straight line expressing the relationship between X and Y. Often used with scatterplots.
The variables REGRESSION_LINE and CORRELATION will be set (see VARIABLES above).
.IP \0
\fBbspline\fR - draws a curve using the bspline algorithm. The \fCorder\fR and \fCresolution\fR
attributes control the appearance of the result. May be used to fit a curve to a histogram.
.IP \0
\fBavg\fR - similar to movingavg except that it also includes \fIn\fR-1 points to the right
of the current point (or as many points as are available) in the average.
Thus, for a point that is far from either edge, 2\fIn\fR-1 points will be averaged.
.IP \0
\fBinterpolated\fR - a spline interpolation between the given data points, ie. the curve will pass through
all input data points (this type is new in version 2.20, code contibuted by Oliver Koch)
.IP \0
Example: \fCcurvetype: movingavg\fR
.ig >>
<br><br>
.>>
.LP
\fBmaxinpoints\fR
.ig >>
.>>
n
.IP \0
Maximum number of input points for curve types other than bspline. Default is 1000. (ver 2.30+)
.ig >>
<br><br><br>
.>>
.SH Details of curve appearance
.LP
\fBorder\fR
.ig >>
.>>
\fIn\fR
.IP \0
For bspline curves, this is a value between 2 and 20; a lower value
yields a more jagged curve, while a higher value gives a smoother curve.
The number of data points must be at least this value for a bspline curve
to be possible.
.IP \0
For movingavg curves, this defines the number of points
to include in each average computation. For avg curves, 2\fIn\fR - 1
points will be considered, where \fIn\fR = the \fCorder\fR value.
.IP \0
This attribute has no effect with regression or interpolated curve.
.IP \0
Default order for either type of curve is 4.
.IP \0
Example: \fCorder: 8\fR
.ig >>
<br><br>
.>>
.LP
\fBresolution\fR
.ig >>
.>>
\fIn\fR
.IP \0
Only relevant for bspline curves.
For every input point, \fIn\fR result points will be generated.
Default is 5.0.
.ig >>
<br><br>
.>>
.LP
\fBlinedetails\fR
.ig >>
.>>
.ig >>
<a href="linedetails.html">
.>>
\0linedetails
.ig >>
</a>
.>>
.IP \0
Appearance details for the curve.
Note that dash patterns may not be effective with generated curves (other than regression curves)
because of point density.
.br
Example: \fClinedetails: color=red width=2.0 \fR
.ig >>
<br><br>
.>>
.LP
\fBxsort\fR
.ig >>
.>>
\fCyes | no\fR
.IP \0
Whether or not to sort the input data on \fCxfield\fR
before generating curves of the \fCinterpolated\fR type.
Default is \fCno\fR.
.ig >>
<br><br><br>
.>>
.SH Range control & selecting data rows
.LP
\fBselect\fR
.ig >>
.>>
.ig >>
<a href="select.html">
.>>
\0select expression
.ig >>
</a>
.>>
.IP \0
Allows selected data points to be included in curve computation.
.br
Example: \fCselect: @@3 > 0\fR
.ig >>
<br><br>
.>>
.LP
\fBcalcrange\fR
.ig >>
.>>
\fImin\fR
.ig >>
.>>
[\fImax\fR]
.IP \0
Data within this X range will be included in curve calculation.
If only one value is given, it will be taken as the range
minima and the maxima will be the plottable maxima.
If not specified all data rows will be included.
.ig >>
<br><br>
.>>
.LP
\fBlinerange\fR
.ig >>
.>>
\fImin\fR
.ig >>
.>>
[\fImax\fR]
.IP \0
Controls the X range (in scaled units) within which the curve will be rendered.
Data points falling outside this range will not be rendered.
If accumulation is being done, points outside the range will contribute
to the accumulated total.
If only one value is given, it will be taken as the range
minima and the maxima will be the plottable maxima.
If not specified all data rows will be plotted.
.IP \0
For regression curves, this attribute may be used to limit
the X range of the regression line, or to create a regression line that extends
beyond the X range of the data.
In this case, \fImin\fR and \fImax\fR should both be given.
.IP \0
Example: \fClinerange: 1\fR
.ig >>
<br><br>
.>>
.LP
\fBclip\fR
.ig >>
.>>
\fCyes | no\fR
.IP \0
Default is \fCno\fR. If set to \fCyes\fR, generated curve will be clipped to the
plotting area in Y. (Regression curves are always clipped.) (2.30+)
.ig >>
<br><br><br>
.>>
.SH Legend
.LP
\fBlegendlabel\fR
.ig >>
.>>
.ig >>
<a href="attributetypes.html#text">
.>>
\0text
.ig >>
</a>
.>>
.IP \0
A label to be associated with the curve in the legend.
\fBproc legend\fR must be executed later in order to
render the legend.
The \fC\\n\fR construct can be used to force a line break
or the label can be wordwrapped using proc legend wraplen attribute (2.32+).
If
.ig >>
<a href="getdata.html">
.>>
\0proc getdata field names
.ig >>
</a>
.>>
are being used,
the special symbol \fC#usefname\fR causes the field name of \fCyfield\fR
to be automatically used as the legend label (2.04+).
.br
Example: \fClegendlabel: Northeast region\fR
.br
Example: \fClegendlabel: #usefname\fR
.ig >>
<br><br><br>
.>>
.SH Accessing the coordinates of the generated curve
.LP
\fBshowresults\fR
.ig >>
.>>
\fCyes\fR | \fCno\fR
.IP \0
If \fCyes\fR, a listing of the points in the computed curve will
be written to the diagnostic stream (-diag).
.ig >>
<br><br>
.>>
.LP
\fBstatsonly\fR
.ig >>
.>>
\fCyes\fR | \fCno\fR
.IP \0
If \fCyes\fR, don't draw the result curve. This is for situations where the user only wants
the computed curve values (\fCshowresults\fR) or the
REGRESSION_LINE and CORRELATION variables to be set.
.ig >>
<br><br><br>
.>>
.SH Variables that are set by proc curvefit
.LP
\fBREGRESSION_LINE\fR
.IP \0
If curvetype is \fCregression\fR, this variable will be set to display
the formula for the regression line.
.LP
\fBCORRELATION\fR
.IP \0
If curvetype is \fCregression\fR, this variable will be set to display
the Pearson correlation coefficient (r), which ranges from -1.0 to 1.0, where
1.0 is a strong correlation (positive slope), -1.0 is a strong correlation
(negative slope), and 0 is no correlation.
.LP
\fBXFINAL\fR and \fBYFINAL\fR
.IP \0
are set to the final location (in scaled space) of the end of the drawn curve.
.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="../doc/welcome.html">
<img src="../doc/ploticus.gif" border=0></a><br><small>data display engine <br>
<a href="../doc/Copyright.html">Copyright Steve Grubb</a>
<br>
<br>
<center>
<img src="../gallery/all.gif">
</center>
</td></tr>
</table>
<br>
<center>
Ploticus is hosted at http://ploticus.sourceforge.net <br>
<img src="http://sourceforge.net/sflogo.php?group_id=38453" width="88" height="31" border="0" alt="SourceForge Logo">
</center>
.>>
|