Learn R Programming

goffda (version 0.1.2)

flm_term: Functional linear model term with bivariate kernel

Description

Computation of the functional linear term $$\int_a^b \beta(s, t) X(s)\,\mathrm{d}s,$$ of a Functional Linear Model with Functional Response (FLMFR), where \(X\) is a random variable in the Hilbert space of square-integrable functions in \([a, b]\), \(L^2([a, b])\), \(\beta\) is the bivariate kernel of the FLMFR, and \(\varepsilon\) is a random variable in \(L^2([c, d])\).

Usage

flm_term(X_fdata, beta, t, int_rule = "trapezoid", equispaced = NULL,
  concurrent = FALSE)

Value

Functional linear model term as the integral (in s) between X_fdata and beta, as an fdata object of length n.

Arguments

X_fdata

sample of functional data as an fdata object of length n.

beta

matrix containing the values \(\beta(s, t)\), for each grid point \(s\) in \([a, b]\) and \(t\) in \([c, d]\). If concurrent = TRUE, a row/column vector must be introduced, valued in the same grid as error_fdata, with the same length as length(X_fdata$argvals).

t

grid points where responses are valued.

int_rule

quadrature rule for approximating the definite unidimensional integral: trapezoidal rule (int_rule = "trapezoid") and extended Simpson rule (int_rule = "Simpson") are available. Defaults to "trapezoid".

equispaced

flag to indicate if X_fdata$data is valued in an equispaced grid or not. Defaults to FALSE.

concurrent

flag to consider a concurrent FLMFR (degenerate case). Defaults to FALSE.

Author

Javier Álvarez-Liébana.

References

García-Portugués, E., Álvarez-Liébana, J., Álvarez-Pérez, G. and Gonzalez-Manteiga, W. (2021). A goodness-of-fit test for the functional linear model with functional response. Scandinavian Journal of Statistics, 48(2):502--528. tools:::Rd_expr_doi("10.1111/sjos.12486")

Examples

Run this code
## Generate a sample of functional responses via FLMFR

# Bivariate kernel beta(s,t) as an egg carton shape
s <- seq(0, 1, l = 101)
t <- seq(0, 1, l = 201)
beta <- outer(s, t, FUN = function(s, t) sin(6 * pi * s) + cos(6 * pi * t))

# Functional data as zero-mean Gaussian process with exponential variogram
X_fdata <- fda.usc::rproc2fdata(n = 50, t = s, sigma = "vexponential",
                                list = list(scale = 2.5))

# Functional error as an OU process with variance 0.075
sigma <- sqrt(0.075) * 2
error_fdata <- r_ou(n = 50, t = t, sigma = sigma)
Y_fdata <- flm_term(X_fdata = X_fdata, beta = beta, t = t) + error_fdata
plot(Y_fdata)

## Generate a sample of functional responses via concurrent model

# Function beta(t)
s <- seq(1, 3, l = 201)
t <- seq(2, 5, l = 201)
beta <- sin(pi * t) + cos(pi * t)

# Functional data as zero-mean Gaussian process with exponential variogram
X_fdata <- fda.usc::rproc2fdata(n = 50, t = s, sigma = "vexponential",
                                list = list(scale = 2.5))

# Functional error as an OU process with variance 0.075
sigma <- sqrt(0.075) * 2
error_fdata <- r_ou(n = 50, t = t, sigma = sigma)
Y_fdata <- flm_term(X_fdata = X_fdata, beta = beta, t = t,
                    concurrent = TRUE) + error_fdata
plot(Y_fdata)

Run the code above in your browser using DataLab