[R] fda Data2fd

Dr. Laca Emilio A. emilioalaca at gmail.com
Fri Mar 26 16:52:50 CET 2010

I would like to create a functional data object where both domain and range are matrices.
My erroneous attempts are below.
Can you suggest corrections?


domain<-matrix(c(1,1.1,1.2,2,2.1,2.1,3,3.1,3.2,4,4.1,4.2,5,5.1,5.2), nrow = 5, ncol=3, byrow=TRUE)

range<-sin(domain)+matrix(rnorm(15,sd=0.1),nrow=5, ncol=3)

myfd<-Data2fd(argvals=domain, y=range)
#Error in create.bspline.basis(argvals) : 
#  rangeval is not a vector;  class(rangeval) = matrix

mybasis<-create.bspline.basis(rangeval=c(0.5,5.2), nbasis=6)

myfd<-Data2fd(argvals=domain, y=range,basisobj=mybasis)
#Error in smooth.basis(argvals, y, fdP, wtvec = w, fdnames = fdnames) : 
# 'y' is not the same length as 'argvals'.

thank you


More information about the R-help mailing list