# Curve quantification

I have some longitudinal measurement data of 15,000. I smoothed that data with B-spline smoothing and got the following curve.

I then want to quantify this curve and extract features for clustering the curve of 15,000 data.

So I will calculate the curvature to quantify the curve and add that curvature to the features. To increase the number of features for clustering, I would like to obtain features by other means of quantification. However, I do not know of any other means of quantifying curves. So, please tell me other ways to quantify the curve.

• How about computing the curves, then performing K-means based on the L2 distance? Or the L2 distance of their second derivative if you are interested in curvatures. Commented Jan 24 at 21:25

As @user11852 you could use refund package in R. It has a function fpcs.sc() that uses B-spline basis functions for estimation of the mean function and bivariate smoothing of the covariance surface. Here is an example using cd4 dataset in refund package.

library(refund)
library(mgcv)

data('cd4', package = 'refund')

Fit.MM <- refund::fpca.sc(cd4, nbasis = 10, npc = 3)
Fit.MM$$scores Fit.MM$$mu

## plot estimated mean function

Fit.mu <- data.frame(mu = Fit.MM\$mu,
d = as.numeric(colnames(cd4)))
ggplot(Fit.mu, aes(x = d, y = mu)) + geom_path() +
labs(x = 'Months since seroconversion', y = 'Total CD4 Cell Count')


One could put all the curves together and apply FPCA. As the underlying data are "dense" we can use the FPCA projection scores directly (e.g. for clustering as in the OPs request) and interpret their respective modes of variation.