Learn R Programming

robflreg (version 1.3)

sff_dgp: Simulate data from a Spatial Function--on--Function Regression model

Description

Generates synthetic functional predictors and responses from the spatial function-on-function regression (SFoFR) data-generating process described in Beyaztas, Shang and Sezer (2025). The model embeds spatial autoregression on the functional response, Fourier-type basis structure for the covariate, and user-controlled Gaussian noise.

Usage

sff_dgp(
  n,
  nphi     = 10,
  gpy      = NULL,
  gpx      = NULL,
  rf       = 0.9,
  sd.error = 0.01,
  tol      = 0.001,
  max_iter = 1000
)

Value

A named list with components

Y

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

Y_true

Same dimension as Y; noise-free latent responses before adding \(\varepsilon_i(t)\).

X

n x length(gpx) matrix of functional predictors.

W

n x n row-normalised spatial weight matrix based on inverse distances.

rho

length(gpy) x length(gpy) matrix containing \(\rho(t,u)\) evaluated on the response grid.

beta

length(gpx) x length(gpy) matrix containing \(\beta(t,s)\) evaluated on the Cartesian product of the predictor and response grids.

Arguments

n

Number of spatial units (curves) to generate.

nphi

Number of sine and cosine basis functions used to build each functional predictor. Total latent scores generated are therefore 2 * nphi.

gpy

Numeric vector of evaluation points for the response domain \(t \in [0,1]\). Defaults to an equally-spaced grid of 101 points.

gpx

Numeric vector of evaluation points for the predictor domain \(s \in [0,1]\). Defaults to an equally-spaced grid of 101 points.

rf

Scalar in \((0,1)\) controlling the strength of spatial autocorrelation through the surface \(\rho(t,u)\). Values closer to 1 yield stronger dependence.

sd.error

Standard deviation of the i.i.d. Gaussian noise \(\varepsilon_i(t)\) added to the latent regression part.

tol

Absolute tolerance used in the fixed-point iteration that solves the spatial autoregressive operator equation (stopping rule on the sup-norm of successive iterates).

max_iter

Maximum number of fixed-point iterations. Prevents infinite looping when strong spatial feedback and small tol interact.

Author

Ufuk Beyaztas, Han Lin Shang, and Gizel Bakicierler Sezer

Details

The generator mimics the penalised SFoFR set-up:

$$ Y_i(t) \;=\; \sum_{j=1}^{n} w_{ij}\int_0^1 Y_j(u)\,\rho(t,u)\,du \;+\; \int_0^1 X_i(s)\,\beta(t,s)\,ds \;+\; \varepsilon_i(t), $$

where

  • \(w_{ij}\) are row-normalised inverse-distance weights,

  • \(X_i(s)\) is built from Fourier scores \(\xi_{ijk} \sim \mathcal{N}(0,1)\) and damped basis functions \(\phi_k^{\cos}(s)=(k^{-3/2})\sqrt{2}\cos(k\pi s)\) and \(\phi_k^{\sin}(s)=(k^{-3/2})\sqrt{2}\sin(k\pi s)\),

  • the regression surface is \(\beta(t,s)=2+s+t+0.5\sin(2\pi s t)\),

  • the spatial autocorrelation surface is \(\rho(t,u)=rf\,(1+ut)/(1+|u-t|)\),

  • \(\varepsilon_i(t)\stackrel{\text{i.i.d.}}{\sim}\mathcal{N}(0,\sigma^2)\), with \(\sigma=\code{sd.error}\).

Given the contraction condition \(\|\rho\|_\infty < 1/\|W\|_\infty\), the Neumann series defining \((\mathbb{I}-\mathcal{T})^{-1}\) converges and the solution is obtained by simple fixed-point iterations until the change is below tol. Full details are in Beyaztas, Shang and Sezer (2025).

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{
# generate a toy data set
dat <- sff_dgp(n = 250, rf = 0.5)
# }

Run the code above in your browser using DataLab