This is basically using least square to estimate the coefficients of spline functions.
Then
and
We can use simple R functions lsfit to estimate the $\Phi$ as follows:
123456789101112131415
# define the rangeRng =c(1,18)age = growth$age
agefine =seq(1,18,len=501)# set up order 6 spline basis with 12 basis functions for# fitting the growth data so as to estimate accelerationnbasis =12;norder =6;heightbasis12 = create.bspline.basis(ageRng, nbasis, norder)# fit the data by least squaresbasismat = eval.basis(age, heightbasis12)heightmat = growth$hgtf
heightcoef = lsfit(basismat, heightmat, intercept=FALSE)$coef
# heightcoef is a 12 * 54 matrix. Each column represents the coefficients for 12 basis functions for each boy.
Or there is a function in the fda package: smooth.basis. This function takes three arguments, $t_j, y_j$ and $\Phi$. That is, the support of the responses, the responses and the bspline basis system. It returns a fd object and several other things.