Local polynomial smoothing in Stata

May 24, 2019

Local smoothing is a smoothing or generalization technique to further enhance the visual representation of a relationship between two variables. In Stata this is achieved with the lpoly (local polynomial smoothing) command. This is especially useful when you’re not getting satisfactory results with for example lfit or qfit. For instance:

sysuse nlsw88, clear lpoly wage grade, nosc

Local polynomial smoothing grid

Note the nosc option, which is short for no scatter. The bandwitdth is set to 1.35 and is a best guess by Stata, but can be se explicity by use of the bw option, like so:

lpoly wage grade, nosc bw(1)

Local polynomial smoothing grid with set bandwidth

A lower bandwith value gives a more pointy curve whereas a higher value gives a more rounder look. (From a purely visual perspective i think the default in this case as set by Stata was sensible enough).


Profile picture

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

2024 © Johan Osterberg