Closed sebffischer closed 7 months ago
s.th like this should do the trick:
library(tf)
x <- tf_rgp(10)
x_pc <- tfb_fpc(x, pve= .9) # truncate PC decomp at 90% explained variance
# PC score vectors for each function are simply the basis coefficient vectors
# making up the object
# (without the first one, which is always 1 for the global mean function)
extract_score_matrix <- function(f) {
assert_class(f, "tfb_fpc")
f |> unclass() |> sapply(\(x) x[-1]) |> t()
}
extract_score_matrix(x_pc)
besides the simple feature extraction through
PipeOpFFS
, another important method is functional PCA.We can implement a
PipeOpFPCA
similar toPipeOpFFS
that does a functional PCA.I think the
tfb_fpc
function can be used here.