Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Get fitted values after locpoly (kernel regression)


From   Partho Sarkar <partho.ss+lists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Get fitted values after locpoly (kernel regression)
Date   Sun, 18 Sep 2011 17:12:20 +0530

Oh, ok- I did miss some details in the help file.  As it stands, your
program will generate a grid of  only 20 pairs of (xhat, ygrid).  What
you have to do is leave out the n(20), and specify the option
at(l_kap_L). This should work:

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

Partho



On Sun, Sep 18, 2011 at 4:33 PM, Tania Treibich
<tania.treibich@gmail.com> wrote:
> Dear Partho,
>
> thank you for your interest!
>
> What I want to do is to fit the model Yi=m(Xi)+ei without making any
> assumption on the functional form of m().
> The output generated by the kernel regression is a graph as well as a
> series of coordinates (new variables created in the database which I
> called xker and yker). These coordinates are the points used for the
> smoothing. Indeed, xker defines the smoothing grid : at each x0 in the
> grid, a weighted regression is performed and associated with a value
> y0. Then all these points are joined.
>
> What I want to retrieve instead is for each value of X, the associated
> value Yhat through the transformation m().
>
> I am now using locpoly for this regression but I saw I can also use
> kernreg2, but I didn't find any help files.
>
> Regards,
>
> Tania
>
>
> 2011/9/18 Partho Sarkar <partho.ss+lists@gmail.com>:
>> Hello Tania
>>
>> I was puzzled by this post at first, as I knew of  locpoly as a R
>> package, rather than a  Stata command.  But a quick search via findit
>> showed the user-written locpoly (a good find for me, as I have an
>> interest in kernel regression too!)  But after looking through the
>> program help file and some examples, I am still puzzled by your
>> question.  What exactly do you mean by "fitted values"?  Are the
>> generated yker values in your example not exactly what one usually
>> calls by that name, or am I missing something?
>>
>> Regards
>> Partho
>>
>> On Sat, Sep 17, 2011 at 1:18 AM, Tania Treibich
>> <tania.treibich@gmail.com> wrote:
>>> Dear Statalist,
>>>
>>> I have done a kernel regression using the command locpoly :
>>> locpoly inv_rate l_kap_L, degree(3) width(1.5) n(20) generate (xker
>>> yker) noscatter
>>>
>>> I want to retrieve the fitted values, is that possible?
>>>
>>> Thank you!
>>>
>>> Tania Treibich
>>> *
>>> *   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/
>>>
>>
>> *
>> *   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/
>>
>
>
>
> --
> --
>
> Tania Treibich
>
> *
> *   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/
>

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index