数据值少于黄土的自由度

时间:2017-10-24 12:29:14

标签: r loess

当我试图在R中执行黄土时,我会收到警告

1: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  span too small.   fewer data values than degrees of freedom.

获得的拟合值与观察值相同(除了第一个和最后一个) 然而我觉得,当我使用2阶回归时,我只需要3个点来适应回归。因为我有一个跨度= 0.16和24的值,这将得到3.84四舍五入到4,所以绰绰有余。

ctg <- c(49L, 33L, 23L, 35L, 49L, 134L, 261L, 415L, 466L, 432L, 442L,  499L, 420L, 412L, 504L, 493L, 554L, 623L, 571L, 620L, 584L, 415L, 
329L, 193L)
span <-  0.16
h <- c(0, 1.04347826086957, 2.08695652173913, 3.1304347826087, 4.17391304347826, 
 5.21739130434783, 6.26086956521739, 7.30434782608696, 8.34782608695652, 
 9.39130434782609, 10.4347826086957, 11.4782608695652, 12.5217391304348, 
 13.5652173913043, 14.6086956521739, 15.6521739130435, 16.695652173913, 
 17.7391304347826, 18.7826086956522, 19.8260869565217, 20.8695652173913,
 21.9130434782609, 22.9565217391304, 24)
loess(ctg ~ h , span = span)

0 个答案:

没有答案