Fit a functional Cox regression model.
Usage
run_fcm(
mxFDAobject,
model_name,
formula,
event = "event",
metric = "uni k",
r = "r",
value = "fundiff",
afcm = FALSE,
smooth = FALSE,
filter_cols = NULL,
...,
knots = NULL
)
Arguments
- mxFDAobject
Dataframe of spatial summary functions from multiplex imaging data, in long format. Can be estimated using the function
extract_summary_functions
or provided separately.- model_name
character string to give the fit model in the functional cox slot
- formula
Formula to be fed to mgcv in the form of survival_time ~ x1 + x2. Does not contain functional predictor. Character valued. Data must contain censoring variable called "event".
- event
character string for the column in Metadata that contains 1/0 for the survival event
- 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".
- afcm
If TRUE, runs additive functional Cox model. If FALSE, runs linear functional cox model. Defaults to linear functional cox model.
- smooth
Option to smooth data using FPCA. Defaults to FALSE.
- 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
- knots
Number of knots for defining spline basis.
Value
A list
which is a linear or additive functional Cox model fit. See mgcv::gam
for more details.
Examples
#load ovarian mxFDA object
data('ovarian_FDA')
#run the lfcm model
ovarian_FDA = run_fcm(ovarian_FDA, model_name = "fit_lfcm",
formula = survival_time ~ age, event = "event",
metric = "uni g", r = "r", value = "fundiff",
afcm = FALSE)