fui {fastFMM} | R Documentation |
Fast Univariate Inference for Longitudinal Functional Models
Description
Fit a function-on-scalar regression model for longitudinal functional outcomes and scalar predictors using the Fast Univariate Inference (FUI) approach (Cui et al. 2022).
Usage
fui(
formula,
data,
family = "gaussian",
var = TRUE,
analytic = TRUE,
parallel = FALSE,
silent = FALSE,
argvals = NULL,
nknots_min = NULL,
nknots_min_cov = 35,
smooth_method = "GCV.Cp",
splines = "tp",
design_mat = FALSE,
residuals = FALSE,
G_return = FALSE,
num_boots = 500,
boot_type = NULL,
seed = 1,
subj_ID = NULL,
num_cores = 1,
caic = FALSE,
REs = FALSE,
non_neg = 0,
MoM = 2
)
Arguments
formula |
Two-sided formula object in lme4 formula syntax. The difference is that the response need to be specified as a matrix instead of a vector. Each column of the matrix represents one location of the longitudinal functional observations on the domain. |
data |
A data frame containing all variables in formula |
family |
GLM family of the response. Defaults to |
var |
Logical, indicating whether to calculate and return variance
of the coefficient estimates. Defaults to |
analytic |
Logical, indicating whether to use the analytic inference
approach or bootstrap. Defaults to |
parallel |
Logical, indicating whether to do parallel computing.
Defaults to |
silent |
Logical, indicating whether to show descriptions of each step.
Defaults to |
argvals |
A vector containing locations of observations on the
functional domain. If not specified, a regular grid across the range of
the domain is assumed. Currently only supported for bootstrap ( |
nknots_min |
Minimal number of knots in the penalized smoothing for the regression coefficients.
Defaults to |
nknots_min_cov |
Minimal number of knots in the penalized smoothing for the covariance matrices.
Defaults to |
smooth_method |
How to select smoothing parameter in step 2. Defaults to |
splines |
Spline type used for penalized splines smoothing. We use the same syntax
as the mgcv package. Defaults to |
design_mat |
Logical, indicating whether to return the design matrix.
Defaults to |
residuals |
Logical, indicating whether to save residuals from
unsmoothed LME. Defaults to |
G_return |
Logical, indicating whether to return (smoothed and trimmed)
G = Cov(u(s_t), u(s_l)). Defaults to |
num_boots |
Number of samples when using bootstrap inference. Defaults to 500. |
boot_type |
Bootstrap type (character): "cluster", "case", "wild", "reb",
"residual", "parametric", "semiparametric". |
seed |
Numeric value used to make sure bootstrap replicate (draws) are correlated across functional domains for certain bootstrap approach |
subj_ID |
Name of the variable that contains subject ID. |
num_cores |
Number of cores for parallelization. Defaults to 1. |
caic |
Logical, indicating whether to calculate cAIC. Defaults to |
REs |
Logical, indicating whether to return random effect estimates.
Defaults to |
non_neg |
0 - no non-negativity constrains, 1 - non-negativity constraints on every coefficient for variance, 2 - non-negativity on average of coefficents for 1 variance term. Defaults to 0. |
MoM |
Method of moments estimator. Default to 2. 1 should only be used for extremely large datasets. |
Details
The FUI approach comprises of three steps:
Fit a univariate mixed model at each location of the functional domain, and obtain raw estimates from massive models;
Smooth the raw estimates along the functional domain;
Obtain the pointwise and joint confidence bands using an analytic approach for Gaussian data or Bootstrap for general distributions.
For more information on each step, please refer to the FUI paper by Cui et al. (2022).
Value
A list containing:
betaHat |
Estimated functional fixed effects |
argvals |
Location of the observations |
betaHat.var |
Variance estimates of the functional fixed effects (if specified) |
qn |
critical values used to construct joint CI |
... |
... |
Author(s)
Erjia Cui ecui@umn.edu, Gabriel Loewinger gloewinger@gmail.com
References
Cui, E., Leroux, A., Smirnova, E., Crainiceanu, C. (2022). Fast Univariate Inference for Longitudinal Functional Models. Journal of Computational and Graphical Statistics, 31(1), 219-230.
Examples
library(refund)
## random intercept only
set.seed(1)
DTI_use <- DTI[DTI$ID %in% sample(DTI$ID, 10),]
fit_dti <- fui(cca ~ case + visit + sex + (1 | ID),
data = DTI_use)