Learn R Programming

robflreg (version 1.3)

sffr_pen2SLS: Penalised Spatial Two-Stage Least Squares for SFoFR

Description

Fits the penalised spatial function-on-function regression (SFoFR) model via the two-stage least-squares (Pen2SLS) estimator introduced by Beyaztas, Shang and Sezer (2025). It selects optimal smoothing parameters, estimates regression and spatial autocorrelation surfaces, and (optionally) builds percentile bootstrap confidence bands.

Usage

sffr_pen2SLS(y, x, W, gpy, gpx, K0, Ky, Kx, lam_cands,
  			 boot = FALSE, nboot = NULL, percentile = NULL)

Value

A named list:

b0hat

Estimated intercept curve \(\widehat{\beta}_0(t)\).

bhat

Matrix of \(\widehat{\beta}(t,s)\) values.

rhohat

Matrix of \(\widehat{\rho}(t,u)\) values.

b0_mat, b_mat, r_mat

Raw coefficient matrices of B-spline basis weights for \(\beta_0\), \(\beta\), and \(\rho\).

fitted.values

\(\widehat{Y}_i(t)\) matrix.

residuals

\(\widehat{\varepsilon}_i(t)\) matrix.

CI_bhat

Two-element list with lower/upper percentile surfaces (NULL unless boot = TRUE).

CI_rhohat

Analogous list for \(\rho\).

CIy

Percentile bands for the fitted responses.

gpy, gpx, K0, Ky, Kx

Returned for convenience.

Arguments

y

n x length(gpy) matrix of functional responses evaluated on grid gpy.

x

n x length(gpx) matrix of functional predictors evaluated on grid gpx.

W

n x n row-normalised spatial weight matrix, typically inverse-distance.

gpy

Numeric vector of response evaluation points \(t \in [0,1]\).

gpx

Numeric vector of predictor evaluation points \(s \in [0,1]\).

K0

Integer; number of basis functions for the intercept \(\beta_0(t)\).

Ky

Integer; number of basis functions in the response direction of the bivariate surfaces \(\rho(t,u)\) and \(\beta(t,s)\).

Kx

Integer; number of basis functions in the predictor direction of the regression surface \(\beta(t,s)\).

lam_cands

Two-column matrix or data frame whose rows contain candidate smoothing pairs \((\lambda_\rho,\;\lambda_\beta)\) to be ranked by BIC.

boot

Logical; if TRUE percentile bootstrap confidence intervals are produced.

nboot

Number of bootstrap resamples. Required when boot = TRUE.

percentile

Desired CI nominal width in percent (e.g., 95). Required when boot = TRUE.

Author

Ufuk Beyaztas, Han Lin Shang, and Gizel Bakicierler Sezer

Details

The estimator minimises the penalised objective

$$ \Vert Z^* \bigl\{\operatorname{vec}(Y) - \Pi\theta\bigr\}\Vert^2 \;+\; \frac{1}{2}\lambda_\rho P(\rho) \;+\; \frac{1}{2}\lambda_\beta P(\beta), $$

where \(\theta = (\operatorname{vec}\rho,\operatorname{vec}\beta)\) are tensor-product B-spline coefficients, \(Z^*\) is the projection onto instrumental variables, and \(P(\cdot)\) are Kronecker-sum quadratic roughness penalties in both surface directions. Candidate smoothing pairs are scored by the Bayesian Information Criterion

$$ \mathrm{BIC} = -2\log\mathcal{L} + \omega \log n, $$

with log-likelihood based on squared residuals and \(\omega\) equal to the effective degrees of freedom.

If boot = TRUE, residuals are centred, resampled, and the entire estimation procedure is repeated nboot times. Lower and upper percentile bounds are then extracted for \(\beta(t,s)\), \(\rho(t,u)\), and \(\widehat{Y}_i(t)\).

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.

Examples

Run this code
# \donttest{
# 1. simulate data
sim <- sff_dgp(n = 100, rf = 0.7)
# 2. candidate smoothing grid (four pairs)
lam <- list(lb = c(10^{-3}, 10^{-2}, 10^{-1}),
            lrho = c(10^{-3}, 10^{-2}, 10^{-1}))
# 3. fit model without bootstrap
fit <- sffr_pen2SLS(y = sim$Y, x = sim$X, W = sim$W,
   gpy = seq(0, 1, length.out = 101),
   gpx = seq(0, 1, length.out = 101),
   K0 = 10, Ky = 10, Kx = 10,
   lam_cands = lam, boot = FALSE)
# }

Run the code above in your browser using DataLab