run_sofr {mxfda} | R Documentation |
Run Scalar on Function Regression
Description
Fit a scalar-on-function regression model. Uses refund::pfr under the hood for computations, and stores results in the mxfda object.
Usage
run_sofr(
mxFDAobject,
model_name,
formula,
family = "gaussian",
metric = "uni k",
r = "r",
value = "fundiff",
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 |
model_name |
character string to give the fit model |
formula |
Formula to be fed to mgcv in the form of outcome ~ x1 + x2. Does not contain functional predictor. Character valued. |
family |
Exponential family distribution to be passed to |
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". |
smooth |
Option to smooth data using FPCA. Defaults to FALSE. |
filter_cols |
a named vector of factors to filter summary functions to in |
... |
Optional other arguments to be passed to |
knots |
Number of knots for defining spline basis. |
Details
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('ovarian_FDA')
# run scalar on function regression model with a continuous outcome (age)
ovarian_FDA = run_sofr(ovarian_FDA,
model_name = "fit_sofr",
formula = age~stage,
metric = "uni g", r = "r", value = "fundiff")
# run scalar on function regression model with a binary outcome (stage)
# also known as functional logistic regression
ovarian_FDA = run_sofr(ovarian_FDA,
model_name = "fit_sofr",
formula = stage~age,
family = "binomial",
metric = "uni g", r = "r", value = "fundiff")