Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • change bandwidth of npregress kernel

    Dear all,

    I am trying to illustrate Engel curves using this command:
    Code:
     npregress kernel income budgetshare_beef
    The red line looks a little too jumpy for my taste. How (in what direction) would I change the bandwidth in order for it to get more linear?

    Thanks a lot in advance!

    Best,
    Julian


  • #2
    Hi Julian
    Keep in mind that npregress estimates the bandwidth so that it is the "optimal" one given your data.
    If you want to relax this optimality condition, I think it would be simpler to use lpoly

    Code:
    lpoly income budgetshare, bw(##) [kernel($$$)] degree(1)
    Degree (1) makes the above command to be a local linear regression, which is the same as npregress does.
    HTH

    Comment


    • #3
      Thanks for pointing that out!

      Just in case I would like to stick to the np regress command, how would I decrease the bandwidth? I struggle to comprehend the options in the help file..

      Best,
      Julian

      Comment


      • #4
        Hi Julian,

        You can make the function more linear by increasing the size of the bandwidth. Below is an example of how I would do this using -npregress kernel-

        Code:
        sysuse auto, clear
        npregress kernel mpg price
        npgraph, name(one, replace)
        matrix A = e(bwidth)*5
        npregress kernel mpg price, bwidth(A)
        npgraph, name(two, replace)
        graph combine one two
        I used the returned matrix -e(bwidth)- as a starting point and then multiply it by a factor. I fed it into the -bwidth()- option after that.

        Comment

        Working...
        X