[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: weighted "lowess"

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: weighted "lowess"
Date   Fri, 14 Dec 2007 12:40:21 -0000

This is difficult. -lowess- doesn't accept weights. The most 
obvious reason is that it uses weights internally as a key part 
of the lowess algorithm. 

In principle, you could -expand- the data first to replicate the 
effect of frequency weights, but that might leave you with a dataset 
of millions, and very slow -lowess-. On the other hand, something like

gen popwt = round(pop/1000) 
expand popwt 
lowess ... 

would be in practice surely precise enough, and faster. 

However, an alternative is to use restricted cubic splines, 
for which weights are allowed. 
-rcspline- from SSC would automate that you (and be _much_ 
faster). Stata 10 is needed. 

Celine Carrere

I use the command "Lowess" to obtain the locally weighted regression of 
the "wage growth" (yvar) on a "geographical variable" (xvar). My 
individuals are cities and I would like to (also) weight the regression 
of yvar on xvar by the number of inhabitants in the city. How can I do?

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index