.- help for ^running^ [sed9: STB-24] .- Symmetric nearest neighbor smoothing ------------------------------------ ^running^ yvar [xvar] [^if^ exp] [^in^ range] [^,^ ^d^ouble ^k^nn^(^#^)^ ^nog^raph ^gen(^newvar^)^ ^log^it ^m^ean ^r^epeat^(^#^)^ ^sp^an^(^#^)^ graph_options ] smooths ^yvar^ on ^xvar^. By default the smoothed version is a running line: a running mean is also available. A graph of ^yvar^ together with its smooth is plotted against ^xvar^, unless suppressed. If ^xvar^ is not provided, ^yvar^ is smoothed against the ordered observations. Options ------- ^double^ doubles the value of ^repeat^. If ^repeat^ is not specified, ^double^ is equivalent to ^repeat(2)^. ^gen(^newvar^)^ creates ^newvar^ containing the smoothed values of ^yvar^. Note that ^newvar^ will be on a logit scale if ^logit^ is used. ^nograph^ suppresses the graph. ^knn(^#^)^ controls the number of nearest neighbors used on each side of the smoothed point. The value of ^knn^ is stored in S_1. The greater the value, the greater the smoothing. If ^span^ is specified ^knn^ is ignored. ^logit^ transforms the smooth and plots the y-axis on a logit scale. The observations are automatically jittered in the vertical scale and are plotted just above and outside the range of the smoothed curve. ^mean^ specifies running-mean least-squares smoothing; default is running-line. ^repeat(^#^)^ specifies the number of times the data are to be smoothed. The default is 1. Increasing ^repeat^ increases the time it takes to calculate the smooth but improves the smooth. However, you may need to increase the bandwidth to obtain the same degree of smoothness. ^span(^#^)^ controls the span or proportion of the data to be used in the symmetric nearest neighbors. If ^span^ is specified, ^knn^ is defined to be (N*^span^-1)/2, where N is the number of observations. If both ^span^ and ^knn^ are specified, ^knn^ is ignored. Stored in S_2. graph_options are any of the options allowed with ^graph, twoway^; see ^help^ ^graph^. Graph plots ^yvar^ followed by its smooth against ^xvar^, the default options are s(oi) and c(.l). Remarks ------- Subsets of (2*k+1) observations are used for calculating smoothed values for each point in the data except for end points, for which smaller uncentered subsets are used. The subsets consist of the closest k points with ^xvar^ values less than or equal to that of the given point, the point itself, and the closest k points with ^xvar^ values greater than or equal to the given point. Since the neighborhoods are asymmetric in the tails, the running-mean is subject to bias in the tails. For this reason the smooth is set to missing in the tails if ^mean^ is specified. Other than in the tails, using ^mean^ will produce the same result as using the default smooth whenever the ^xvar^ values are evenly spaced. ^repeat(^3^)^, for instance, first smooths ^yvar^ creating yhat1, say; next yhat1 is smoothed creating yhat2, and finally yhat2 is smoothed creating yhat3. Author ------ Peter Sasieni Imperial Cancer Research Fund, London FAX 011-44-171-269-3429 Also see -------- Manual: [5s] ksm, [5s] smooth STB: sed9 (STB-23) On-line: ^help^ for @ksm@ and @smooth@