Learn R Programming

robflreg (version 1.3)

predict_sffr2SLS: Out-of-sample prediction for Penalised Spatial FoFR models

Description

Given a fitted model returned by sffr_pen2SLS, this function produces predicted functional responses at new spatial units whose functional covariates and spatial weight matrix are supplied by the user. A fixed-point solver enforces the spatial autoregressive feedback implicit in the SFoFR model.

Usage

predict_sffr2SLS(object, xnew, Wnew)

Value

A numeric matrix of dimension \(n_\mathrm{new} \times |\mathrm{gpy}|\) containing the predicted functional responses evaluated on gpy. Row \(i\) corresponds to the i-th row of xnew.

Arguments

object

An object of class "sffr2SLS": the list produced by sffr_pen2SLS. At minimum it must contain gpx, gpy, K0, Ky, Kx, and the B-spline coefficient matrices b0_mat, b_mat, r_mat.

xnew

Numeric matrix of dimension \(n_\mathrm{new} \times |\mathrm{gpx}|\), holding the functional covariate for the new spatial units, evaluated on the same predictor grid used during model fitting.

Wnew

Row-normalised \(n_\mathrm{new} \times n_\mathrm{new}\) spatial weight matrix that captures proximity among the new units. Its definition should mirror that of the training matrix (e.g. inverse distance, k-nearest neighbours, etc.).

Author

Ufuk Beyaztas, Han Lin Shang, and Gizel Bakicierler Sezer

Details

Let \(\widehat{\beta}_0(t)\), \(\widehat{\beta}(t,s)\), and \(\widehat{\rho}(t,u)\) be the estimated surfaces stored in object. For each new unit i the algorithm first forms the non-spatial regression prediction

$$ \widehat{G}_i(t) \;=\; \widehat{\beta}_0(t) + \int_{0}^{1} X_i(s)\,\widehat{\beta}(t,s)\,ds, $$

computed efficiently by pre-evaluated B-spline bases. Spatial feedback is then introduced by iterating $$ Y_{i}^{(\ell+1)}(t) \;=\; \widehat{G}_i(t) + \sum_{j=1}^{n_\mathrm{new}} w_{ij} \int_{0}^{1} Y_j^{(\ell)}(u)\,\widehat{\rho}(t,u)\,du, $$ until the sup-norm difference between successive curves falls below 1e-3 or 1,000 iterations are reached. Convergence is guaranteed when \(\|\widehat{\rho}\|_\infty < 1/\|Wnew\|_\infty\), a condition typically satisfied by the fitted model if the training weight matrix met it during estimation.

References

Beyaztas, U., Shang, H. L., and Sezer, G. B. (2025). Penalised Spatial Function-on-Function Regression. Journal of Agricultural, Biological, and Environmental Statistics, in press.

See Also

sff_dgp for simulated data generation; sffr_pen2SLS for model fitting.

Examples

Run this code
# \donttest{
# 1. Fit a model on small simulated data
train <- sff_dgp(n = 500, rf = 0.5)
lam   <- list(lb = c(10^{-3}, 10^{-2}, 10^{-1}), lrho = c(10^{-3}, 10^{-2}, 10^{-1}))
fit <- sffr_pen2SLS(train$Y, train$X, train$W,
                    gpy = seq(0, 1, length = 101),
                    gpx = seq(0, 1, length = 101),
                    K0 = 10, Ky = 10, Kx = 10,
                    lam_cands = lam)

# 2. Simulate NEW covariates and a compatible weight matrix
test <- sff_dgp(n = 1000, rf = 0.5)  ## we keep only X and W
pred <- predict_sffr2SLS(fit, xnew = test$X, Wnew = test$W)
# }

Run the code above in your browser using DataLab