开发者

Statistics Question: Kernel Smoothing in R

开发者 https://www.devze.com 2023-01-03 08:48 出处:网络
I have data of this form: xy 10.19 20.26 30.40 40.58 50.59 开发者_如何学C 61.24 70.68 80.60 91.12

I have data of this form:

 x    y
 1    0.19
 2    0.26 
 3    0.40
 4    0.58
 5    0.59
开发者_如何学C 6    1.24
 7    0.68
 8    0.60
 9    1.12
10    0.80
11    1.20
12    1.17
13    0.39

I'm currently plotting a kernel-smoothed density estimate of the x versus y using this code:

   smoothed = ksmooth( d$resi, d$score, bandwidth = 6 )
   plot( smoothed )

I simply want a plot of the x versus smoothed(y) values, which is ## Heading ##

However, the documentation for ksmooth suggests that this isn't the best kernel-smoothing package available:

This function is implemented purely for compatibility with S, although it is nowhere near as slow as the S function. Better kernel smoothers are available in other packages.

What other kernel smoothers are better and where can these smoothers be found?


If you "simply want a plot of the x versus smoothed(y)", then I recommend considering loess in package stats - it's simple, fast and effective. If instead you really want a regression based on kernel smoothing, then you could try locpoly in package KernSmooth or npreg in package np.

0

精彩评论

暂无评论...
验证码 换一张
取 消