run_mfcm {mxfda}R Documentation

Run function Cox models for data with multiple samples per subject

Description

Fit a functional Cox regression model when there are multiple functions per subject, which arise from multiple samples per subject. It is not necessary for all subjects to have the same number of samples.The function first performs a multilevel functional principal components analysis (MFPCA) decomposition to the spatial summary function. Then, the average curve for each subject is used in a functional Cox model (FCM). Variation around each subject's mean is captured by calculating the standard deviation of the level 2 scores from MFPCA, then including this as a scalar variable in the FCM called "level2_score_sd".

Usage

run_mfcm(
  mxFDAobject,
  model_name,
  formula,
  event = "event",
  metric = "uni k",
  r = "r",
  value = "fundiff",
  afcm = FALSE,
  filter_cols = NULL,
  pve = 0.99,
  ...,
  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.

filter_cols

a named vector of factors to filter summary functions to in c(Derived_Column = "Level_to_Filter") format

pve

Proportion of variance explained by multilevel functional principal components analysis in mfpca step

...

Optional other arguments to be passed to fpca.face

knots

Number of knots for defining spline basis.

Details

[Stable]

Value

A list which is a linear or additive functional Cox model fit. See mgcv::gam for more details.

Author(s)

Julia Wrobel julia.wrobel@emory.edu

Alex Soupir alex.soupir@moffitt.org

Examples

#load ovarian mxFDA object
data('lung_FDA')

# run the lfcm model
lung_FDA = run_mfcm(lung_FDA, model_name = "fit_mlfcm",
                      formula = survival_days ~ age,
                      event = "survival_status",
                      metric = "uni g", r = "r", value = "fundiff",
                      pve = 0.99,
                      afcm = FALSE)

[Package mxfda version 0.2.1 Index]