R 多元插值 - chebpol 包的替代方案

Bro*_*ics 3 r

chebpol包已存档在 CRAN 上,因此我正在寻找 chebpol::ipol(..., method = "polyharmonic").

我正在尝试在四维、规则、均匀网格上插入(和推断)一个函数,但缺少一些点。上面提到的chebpol::ipol函数非常适合:

known <- data.table::data.table(
  a = c(1, 1, 1, 1, 2, 2, 2, 2),
  b = c(1, 1, 2, 2, 1, 1, 2, 2),
  c = c(1, 1, 2, 3, 2, 2, 3, 4),
  d = c(1, 2, 3, 4, 1, 2, 3, 4)
)
known[, score := a + b + c + d] # example values

f <- chebpol::ipol(
  val = known[, score], 
  knots = t(as.matrix(known[, c("a", "b", "c", "d")])),
  method = "polyharmonic"
)

f(c(1, 2, 4, 3)) # expected result: 10
Run Code Online (Sandbox Code Playgroud)

如果没有chebpol包,如何实现上述目标?

Ben*_*ker 6

感谢@MikaelJagan,现在可以在此处找到该软件包的修补版本。remotes::install_github("bbolker/chebpol")如果您安装了开发工具(编译器等),您应该能够使用 来安装它。(这是作者存储库的分叉版本我将在修复其他几个小检查错误之前或之后提交拉取请求。)