| Title: | Function-on-Scalar Regression with Group-Bridge Penalty |
|---|---|
| Description: | Implements a group-bridge penalized function-on-scalar regression model proposed by Wang et al. (2023) <doi:10.1111/biom.13684>, to simultaneously estimate functional coefficient and recover the local sparsity. |
| Authors: | Zhengjia Wang [aut, cre] (ORCID: <https://orcid.org/0000-0001-5629-1116>), Meng Li [aut] (ORCID: <https://orcid.org/0000-0003-2123-2444>) |
| Maintainer: | Zhengjia Wang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.9.2 |
| Built: | 2026-06-01 11:33:44 UTC |
| Source: | https://github.com/dipterix/spfda |
'refund' packageA modified version of fosr.vs, but
with groups parameter to allow grouping time points rather than the
whole coefficient when the underlying functions are locally supported.
fosr_vs( formula, data, nbasis = 10, method = c("ls", "grLasso", "grMCP", "grSCAD"), epsilon = 1e-05, max.iter_num = 100, groups = NULL )fosr_vs( formula, data, nbasis = 10, method = c("ls", "grLasso", "grMCP", "grSCAD"), epsilon = 1e-05, max.iter_num = 100, groups = NULL )
formula, data, nbasis, method, epsilon, max.iter_num
|
see
|
groups |
integer vector with length of number of time-points
of how time-points should be grouped; default
is |
Function-on-scalar regression model, denote \(n\) as total number of observations, \(p\) the number of coefficients, \(K\) as the number of B-splines, \(T\) as total time points.
spfda( Y, X, lambda, time = seq(0, 1, length.out = ncol(Y)), nsp = "auto", ord = 4, alpha = 0.5, W = NULL, init = NULL, max_iter = 50, inner_iter = 50, CI = FALSE, ... )spfda( Y, X, lambda, time = seq(0, 1, length.out = ncol(Y)), nsp = "auto", ord = 4, alpha = 0.5, W = NULL, init = NULL, max_iter = 50, inner_iter = 50, CI = FALSE, ... )
Y |
Numeric \(n \times T\) matrix, response function. |
X |
Numeric \(n \times p\) matrix, design matrix |
lambda |
Regularization parameter \(\gamma\) |
time |
Time domain, numerical length of \(T\) |
nsp |
Integer or 'auto', number of B-splines \(K\); default is 'auto' |
ord |
B-spline order, default is |
alpha |
Bridge parameter \(\alpha\), default is |
W |
A \(T \times T\) weight matrix or |
init |
Initial \(\gamma\); default is |
max_iter |
Number of outer iterations |
inner_iter |
Number of \(ADMM\) iterations (inner steps) |
CI |
Logical, whether to calculate theoretical confidence intervals |
... |
Ignored |
This function implements "Functional Group Bridge for Simultaneous
Regression and Support Estimation" (doi:10.1111/biom.13684).
The model estimates functional coefficients \(\beta(t)\) under model
\[y(t) = X\beta(t) + \epsilon(t)\] with B-spline basis expansion
\[\beta(t) = \gamma B(t) + R(t), \] where \( R(t) \) is B-spline
approximation error. The objective function
\[
\left\| (Y-X\gamma B)W \right\|_{2}^{2} + \sum_{j,m}
\left\| \gamma_{j}^{T}\mathbf{1}(B^{t} > 0) \right\|_{1}^{\alpha}.
\]
The input response variable is a matrix. If \(y_{i}(t)\) are observed
at different time points, please interpolate (e.g.
kernel) before feeding in.
A spfda.model object (environment) with following elements:
B-spline basis functions used
Root Mean Square Error ('RMSE')
Whether confidence intervals are calculated
B-spline coefficient \(\gamma_{p \times K}\)
Function to generate B-splines given time points
Number of B-spline basis functions
B-spline knots used to fit the model
Function to predict responses \(\beta(t)\) given new
X and/or time points
A list of raw variables
dat <- spfda_simulate() x <- dat$X y <- dat$Y fit <- spfda(y, x, lambda = 5, CI = TRUE) BIC(fit) plot(fit, col = c("orange", "dodgerblue3", "darkgreen"), main = "Fitted with 95% CI", aty = c(0, 0.5, 1), atx = c(0,0.2,0.8,1)) matpoints(fit$time, t(dat$env$beta), type = 'l', col = 'black', lty = 2) legend('topleft', c("Fitted", "Underlying"), lty = c(1,2)) print(fit) coefficients(fit)dat <- spfda_simulate() x <- dat$X y <- dat$Y fit <- spfda(y, x, lambda = 5, CI = TRUE) BIC(fit) plot(fit, col = c("orange", "dodgerblue3", "darkgreen"), main = "Fitted with 95% CI", aty = c(0, 0.5, 1), atx = c(0,0.2,0.8,1)) matpoints(fit$time, t(dat$env$beta), type = 'l', col = 'black', lty = 2) legend('topleft', c("Fitted", "Underlying"), lty = c(1,2)) print(fit) coefficients(fit)
Synthesized functional signals with heterogeneous error. The underlying three coefficients correspond to 'dense', 'global sparse', and 'local sparse' functions. See doi:10.1111/biom.13684 for detailed configurations.
spfda_simulate(n = 1000, n_timepoints = 100, err = 1, scale = c(1, 1, 1))spfda_simulate(n = 1000, n_timepoints = 100, err = 1, scale = c(1, 1, 1))
n |
Total number of observations |
n_timepoints |
Total number of time points |
err |
Error magnitude |
scale |
the scale of coefficients length of 1 or 3. |
A list of data generated: X is scalar predictor, Y is
functional response.
Calculates weight matrices
spfda_weight(X, Y, bandwidth, part)spfda_weight(X, Y, bandwidth, part)
X |
design matrix |
Y |
response matrix |
bandwidth |
numeric band-width |
part |
list of time point boundaries |
the weight matrix