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

# Re: st: computing elasticities after using lpoly

 From Arka Roy Chaudhuri To statalist@hsphsun2.harvard.edu Subject Re: st: computing elasticities after using lpoly Date Sun, 21 Oct 2012 00:08:44 -0700

```Sorry for the delay in responding.But thanks a lot for this example
showing how to recover the coefficients from lpoly.It helped me a lot.

On Tue, Oct 9, 2012 at 8:53 AM, Austin Nichols <austinnichols@gmail.com> wrote:
> Arka Roy Chaudhuri <gabuisi@gmail.com>:
> For a worked example, try:
>
> webuse motorcycle, clear
> lpoly accel time, deg(1) k(tri) bw(3) gen(x s)
> qui levelsof x, loc(xs)
> g double schk=.
> g double b=.
> loc i 1
> qui foreach l of loc xs {
>  gen double w=max(0,3-abs(time-`l'))
>  reg accel time [aw=w]
>  replace schk=_b[_cons]+_b[time]*`l' in `i'
>  replace b=_b[time] in `i'
>  drop w
>  loc i=`i'+1
>  }
> assert float(s)==float(schk)
> la var b "Slope"
> la var s "Conditional mean"
> sc s b x, msize(small small) c(l) name(slopes)
>
>
> On Tue, Oct 9, 2012 at 10:56 AM, Austin Nichols <austinnichols@gmail.com> wrote:
>> Arka Roy Chaudhuri <gabuisi@gmail.com>:
>> You can also get the coefs from an -lpoly- graph by noting the kernel
>> type, bandwidth, and degree, then estimating the weighted regressions
>> yourself, saving the coefs each time.  If you specify the -generate(x
>> s)- option you can also get all the X points at which regressions are
>> estimated.
>>
>> On Sun, Oct 7, 2012 at 1:52 AM, Arka Roy Chaudhuri <gabuisi@gmail.com> wrote:
>>> Thanks a lot to Nick and Maarten for all the advice.I really
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```