The code presented performs simple OLS regression using the B-spline representation of x
. We can directly inspect that B-spline basis by typing:
matplot(x=x, bs(x = x, df = k, degree = l ), pch= 15)
. Usually these kind of models are referred as Generalised Additive Models (GAMs). The book "Generalized Additive Models An Introduction with R", 2nd Ed. by S. Wood is consider a standard reference on these kind of models.
Functional linear regression is a bit more involved. At the simplest level, it is concerned with modelling tasks where at least one of the components of our analysis (a predictor or the response) is entering our model as a function instead of a scalar; e.g. our analysis units for the $i$-th subject in our analysis are ($y_i, f_i(x)$) instead of the classical ($y_i, x_i$).
To give a more tangible example: a model where we model the IQ of a child at 5 years old ($y$) as a function of the child's weight at 6 months old ($w$), can be seen as a simple regression model. We might wish to incorporate non-linear effects by using splines, etc. (in which case our units of analysis would be like ($y_i, s(w_i)$) but that is still not a functional regression model. On the other hand, a model where we model the IQ of a child at 5 years old ($y$) as a function of the child's weight measurement during its first 12 months of life ($w_i(t)$), can be seen as a functional regression model; our predictor containing weight information is a function $w_i(t)$ where each function $w$ is associated with our $i$ subject (and $t$ here spans the continuum $[0,12]$ months). Our predictor is "a function" instead of a scalar (or a vector).
You might wish to review some classic papers like "Functional linear regression analysis for longitudinal data" by Yao et al. (2005) or "Prediction in functional linear regression" by Kai & Hall (2006) for more information. More generally, I have found the book "Inference for Functional Data with Applications" a great read on the matter.