This is a wrapper for the function fpca.face
from the refund
package. EXPAND
Usage
run_fpca(
mxFDAobject,
metric = "uni k",
r = "r",
value = "fundiff",
knots = NULL,
analysis_vars = NULL,
lightweight = FALSE,
filter_cols = NULL,
...
)
Arguments
- mxFDAobject
object of class
mxFDA
created bymake_mxfda
with metrics derived withextract_summary_functions
- metric
name of calculated spatial metric to use
- r
Character string, the name of the variable that identifies the function domain (usually a radius for spatial summary functions). Default is "r".
- value
Character string, the name of the variable that identifies the spatial summary function values. Default is "fundiff".
- knots
Number of knots for defining spline basis.Defaults to the number of measurements per function divided by 2.
- analysis_vars
Optional list of variables to be retained for downstream analysis.
- lightweight
Default is FALSE. If TRUE, removes Y and Yhat from returned FPCA object. A good option to select for large datasets.
- filter_cols
a named vector of factors to filter summary functions to in
c(Derived_Column = "Level_to_Filter")
format- ...
Optional other arguments to be passed to
fpca.face
Value
A mxFDA
object with the functional_pca
slot filled for the respective spatial summary function containing:
- mxfundata
The original dataframe of spatial summary functions, with scores from FPCA appended for downstream modeling
- fpc_object
A list of class "fpca" with elements described in the documentation for
refund::fpca.face
Details
The filter_cols
parameter is useful when the summary function was input by the user using add_summary_function()
and the multiple marks were assessed; a column called "Markers" with tumor infiltrating lymphocytes as well as cytotoxic T cells. This parameter allows for filtering down to include only one or the other.
References
Xiao, L., Ruppert, D., Zipunnikov, V., and Crainiceanu, C. (2016). Fast covariance estimation for high-dimensional functional data. Statistics and Computing, 26, 409-421. DOI: 10.1007/s11222-014-9485-x.
Examples
#load ovarian mxFDA object
data('ovarian_FDA')
#run the FPCA
ovarian_FDA = run_fpca(ovarian_FDA, metric = "uni g", r = "r", value = "fundiff",
lightweight = TRUE,
pve = .99)
#> 128 sample have >= 4 values for FPCA; removing 0 samples