Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Get fitted values after locpoly (follow-up)

 From Nick Cox To "statalist@hsphsun2.harvard.edu" Subject Re: st: Get fitted values after locpoly (follow-up) Date Wed, 21 Sep 2011 12:32:48 +0100

I don't see that fitting at a smaller set of points will itself confer resistance to outliers. Also, these local polynomial fits are all more or less fancy ways of averaging and so none is especially suited to what appears to be your aim. Furthermore, I doubt that you can extend local polynomial fits beyond the data used as the command(s) in question do not save anything useful for that purpose.
```
```
To discount outliers and to get an otherwise smooth curve I would use - glm- with an appropriate link (e.g. logarithmic) and cubic spline variables on the right-hand side.
```
```
Finally, it's my recollection that -locpoly- is a user-written command and has been superseded by -lpoly-, although the latter is not more useful for resistant-robust smoothing than the former. As a general point you are asked to flag where user-written commands you refer to come from.
```
Nick

```
On 21 Sep 2011, at 11:58, Tania Treibich <tania.treibich@gmail.com> wrote:
```
```
```Dear Stata List users

I could get fitted values for my kernel regression using the at()
option of lpoly instead of the n() option:

locpoly inv_rate l_kap, at(l_kap) generate (yfitted) degree(3)
width(1.5) noscatter

This indeed computes the smoothing and creates the fitted value
yfitted for all the values of l_kap. However,  it gives too much
weight to outliers.

Instead, I would like the kernel regression to be computed only on a
limited number of points (as in the option n(50) ) BUT get the fitted
(approximated) value for ALL observations.
```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```