help localp

Kernel-weighted local polynomial smoothing (customised version)

Syntax

localp yvar xvar
[if] [in]
[weight]
[,
options
]

Description

localp is a customised version of lpoly, smoothing
yvar as a function of xvar.

Defaults include
kernel(biweight),
degree(1),
bwidth() given by rounding 0.2 of the range of xvar down to
a nice number,
at(xvar),
ms(Oh) and
title(, size(medium) place(w)) with text such as "local linear
smooth".

R-square and RMSE statistics of the smoother are shown based on
regression of smoothed on original values of yvar for the values of
xvar.

fweights and aweights are allowed. See weights.

Remarks

localp is indicative, not definitive. It was written primarily for
teaching.

The default bandwidth is just an arbitrary choice and emphatically not
the result of any kind of optimisation. localp offers both
opportunity and obligation to change bandwidth to identify instructive
and useful smooths.

The display of R-square and RMSE is essentially for guidance and for
comparison with results for other methods. It should be emphasised that
the goal of local polynomial regression is in no sense to maximise that
R-square or to minimise that RMSE. Indeed, high R-square and low RMSE
may often be achieveable by minimal smoothing, but not helpfully.

Options

See lpoly.

Examples

. sysuse auto, clear

. localp dispacement weight

. localp dispacement weight, bw(300)

(means by category with sufficiently small bandwidth)

. localp mpg rep78, lineopts(recast(connect) ms(Th) msize(*2))

. webuse motorcycle

. localp accel time

. localp accel time, bw(3)

Author

Nicholas J. Cox, Durham University

n.j.cox@durham.ac.uk

Acknowledgments

Ariel Linden suggested use of the motorcycle data as an example.

Also see

Manual: [R] lpoly, [G] graph twoway