Learn R Programming

goffda (version 0.0.7)

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)

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

vectors with grid points where functions 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.

Value

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

References

Garc<U+00ED>a-Portugu<U+00E9>s, E., <U+00C1>lvarez-Li<U+00E9>bana, J., <U+00C1>lvarez-P<U+00E9>rez, G. and Gonz<U+00E1>lez-Manteiga, W. (2019). A goodness-of-fit test for the functional linear model with functional response. arXiv:1909.07686. https://arxiv.org/abs/1909.07686

Examples

Run this code
# NOT RUN {
## 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