我有这种形式的数据:
x y
1 0.19
2 0.26
3 0.40
4 0.58
5 0.59
6 1.24
7 0.68
8 0.60
9 1.12
10 0.80
11 1.20
12 1.17
13 0.39
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码绘制x与y的内核平滑密度估计值:
smoothed = ksmooth( d$resi, d$score, bandwidth = 6 )
plot( smoothed )
Run Code Online (Sandbox Code Playgroud)
我只想要一个x与平滑(y)值的关系图,即## Heading ##
该功能纯粹是为了与S兼容而实现的,尽管它远不如S功能那么慢.其他包中提供了更好的内核平滑器.
什么其他内核平滑器更好,哪些可以找到这些平滑器?
nul*_*lob 11
如果你"只是想在X的对平滑(Y)的阴谋",那么我建议考虑 loess在包stats-这是简单,快速和有效.如果您真的想要基于内核平滑的回归,那么您可以尝试locpoly在包KernSmooth或npreg包中np.