{smcl}
{* 23dar2002}{...}
{hline}
help for {hi:ksmapprox}
{hline}

{title:Smoothing including lowess}

{p 8 12}{cmd:ksmapprox} {it:yvar} {it:xvar} [{cmd:if} {it:exp}]
[{cmd:in} {it:range}] {bind:[{cmd:,} {cmdab:num:}{cmd:(}{it:#}{cmd:)}
{cmdab:l:ine}} {cmdab:w:eight} {cmdab:low:ess}
{cmdab:bw:idth}{cmd:(}{it:#}{cmd:)} {cmdab:lo:git}
{cmdab:gen:erate}{cmd:(}{it:newvar}{cmd:)} {cmdab:nog:raph}
{it:graph_options} ]


{title:Description}

{p}{cmd:ksmapprox} carries out unweighted and locally weighted
smoothing of {it:yvar} on {it:xvar}, displays the graph, and
optionally saves the smoothed variable.  Among {cmd:ksmapprox}'s
capabilities are lowess (robust locally weighted regression).

{p}Note: {cmd:ksmapprox} differs from {cmd:ksm} in that it allows the
option {cmd:num(#)} which specifies the number of points of {it:xvar}
at which the smooth is computed.  For lowess on a large number of
observations (say, 10000), specifying, say, {cmd:num(100)} will mean
that only 100 regressions are computed, rather than the 10000 that
would have been computed using {cmd:ksm}.


{title:Options}

{p 0 4}{cmd:num}{cmd:(}{it:#}{cmd:)} specifies the number of
observations for which the smooth will be computed.  If {cmd:#}<=0
or is greater than the total number of observations, then the smooth
is computed for all observations.  Otherwise, the smooth is computed
for the corresponding quantiles of {it:xvar}.  For example, if
{cmd:num(100)} is specified, the smooth is only computed for each
percentile of {it:xvar}.  For other values of {it:xvar}, a missing
value is returned.

{p 0 4}{cmd:line} specifies running-line least-squares smoothing; the default
is running mean.

{p 0 4}{cmd:weight} specifies use of Cleveland's (1979) tricube weighting
function; the default is unweighted.

{p 0 4}{cmd:lowess} is equivalent to specifying "{cmd:line weight}" and
requests Cleveland's lowess running-line smoother.

{p 0 4}{cmd:bwidth}{cmd:(}{it:#}{cmd:)} specifies the bandwidth.  Centered
subsets of {cmd:bwidth()}{cmd:*}N observations are used for calculating
smoothed values for each point in the data except for end points, where
smaller, uncentered subsets are used.  The greater the {cmd:bwidth()}, the
greater the smoothing.  The default is 0.8.

{p 0 4}{cmd:logit} transforms the smoothed {it:yvar} into logits.

{p 0 4}{cmd:generate}{cmd:(}{it:newvar}{cmd:)} creates {it:newvar} containing
the smoothed values of {it:yvar} in addition to or instead of displaying the
graph.

{p 0 4}{cmd:nograph} suppresses displaying the graph.

{p 0 4}{it:graph_options} are any of the options allowed with {cmd:graph, twoway}; see help {help grtwoway}.


{title:Examples}

{p 8 12}{inp:. ksmapprox h1 depth, lowess}{p_end}
{p 8 12}{inp:. ksmapprox h1 depth, lowess ylab xlab}{p_end}
{p 8 12}{inp:. ksmapprox h1 depth, lowess ylab xlab bwidth(.4)}


{title:Also see}

Manual: {hi:[R] ksm} {p 0 19}On-line: help for {help ksm}, {help
graph}, {help ipolate}, {help smooth}{p_end}
