具有大量基函数的 R 中函数数据的 bspline 平滑错误

Error with bspline smoothing for functional data in R with high number of basis functions

我在 R 中有这个错误,我无法解决它:

Error in chol.default(temp) : the leading minor of order 445 is not positive definite In addition: Warning message: In smooth.basis1(argvals, y, fdParobj, wtvec = wtvec, fdnames = fdnames, : Matrix of basis function values has rank 799 < dim(fdobj$basis)[2] = 800 ignoring null space

我想平滑数据。我的数据集有 44 467 行,只有一个变量需要平滑。我没有问题可以平滑 200,300,400,500,600,700 函数。但我不能用 800,我不明白为什么。这是一个没有惩罚的 b 样条平滑。 (我也没有问题用 200,300,400,500,600,700 个函数来平滑惩罚。)

 n=44467
 argvals=data_totale$temps_ref_st

library(fda)
TableGCV<-c()

i is the number of basis
j lambda for penalization (here =0)

 for (i in c(800)) {
 for (j in c(0)) { 
basisobj = create.bspline.basis(c(0, max(argvals)),i)

fdParobj = fdPar(fdobj=basisobj, Lfdobj=2, j)

smoothlist = smooth.basis(argvals, mdata, fdParobj)

xfd_acc = smoothlist$fd 
xfd_acc_coef = smoothlist$fd$coefs

#GCV output
gcv = smoothlist$gcv 
TableGCV <- rbind(TableGCV,c(i,j,gcv))

 }
} 

感谢您的帮助

此代码适用于我的 R:

library(fda)
n <- 44467
set.seed(12345)
argvals <- 1:n
mdata <- cumsum(rnorm(n))

TableGCV<-c()
for (i in c(800)) {
  for (j in c(0)) { 
    basisobj <- create.bspline.basis(c(0, max(argvals)),i)
    fdParobj <- fdPar(fdobj=basisobj, Lfdobj=2, j)
    smoothlist <- smooth.basis(argvals, mdata, fdParobj)
    xfd_acc <- smoothlist$fd 
    xfd_acc_coef <- smoothlist$fd$coefs
    gcv <- smoothlist$gcv 
    TableGCV <- rbind(TableGCV,c(i,j,gcv))
 }
} 
plot(smoothlist)