Description Usage Arguments Details Value Author(s) References Examples
Computes the Cramer-von Mises (CvM) and Kolmogorov-Smirnov (KS) statistics on the projected process
T_{n, h}(u)=1/n∑_{i = 1}^n (Y_i - <X_i, \hat β>)1_{<X_i, h> ≤ u},
designed to test the goodness-of-fit of a functional linear model with scalar response.
1 | rp.flm.statistic(proj.X, residuals, proj.X.ord = NULL, F.code = TRUE)
|
proj.X |
matrix of size |
residuals |
the residuals of the fitted functional linear model, Y_i - <X_i, \hat β, Y_i>. Either a vector of length |
proj.X.ord |
matrix containing the row permutations of |
F.code |
whether to use faster |
NA's are not allowed neither in the functional covariate nor in the scalar response.
A list containing:
statistica matrix of size c(n.proj, 2) with the CvM (first column) and KS (second) statistics, for the n.proj different projections.
proj.X.ordthe computed row permutations of proj.X, useful for recycling in subsequent calls to rp.flm.statistic with the same projections but different residuals.
Eduardo García-Portugués (edgarcia@est-econ.uc3m.es) and Manuel Febrero-Bande (manuel.febrero@usc.es).
Cuesta-Albertos, J.A., García-Portugués, E., Febrero-Bande, M. and González-Manteiga, W. (2019). Goodness-of-fit tests for the functional linear model based on randomly projected empirical processes. Annals of Statistics, 47(1):439-467. https://doi.org/10.1214/18-AOS1693
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # Simulated example
set.seed(345678)
t <- seq(0, 1, l = 101)
n <- 100
X <- r.ou(n = n, t = t)
beta0 <- fdata(mdata = cos(2 * pi * t) - (t - 0.5)^2, argvals = t,
rangeval = c(0,1))
Y <- inprod.fdata(X, beta0) + rnorm(n, sd = 0.1)
# Linear model
mod <- fregre.pc(fdataobj = X, y = Y, l = 1:3)
# Projections
proj.X1 <- inprod.fdata(X, r.ou(n = 1, t = t))
proj.X2 <- inprod.fdata(X, r.ou(n = 1, t = t))
proj.X12 <- cbind(proj.X1, proj.X2)
# Statistics
t1 <- rp.flm.statistic(proj.X = proj.X1, residuals = mod$residuals)
t2 <- rp.flm.statistic(proj.X = proj.X2, residuals = mod$residuals)
t12 <- rp.flm.statistic(proj.X = proj.X12, residuals = mod$residuals)
t1$statistic
t2$statistic
t12$statistic
# Recycling proj.X.ord
rp.flm.statistic(proj.X.ord = t1$proj.X.ord, residuals = mod$residuals)$statistic
t1$statistic
# Sort in the columns
cbind(proj.X12[t12$proj.X.ord[, 1], 1], proj.X12[t12$proj.X.ord[, 2], 2]) -
apply(proj.X12, 2, sort)
# FORTRAN and R code
rp.flm.statistic(proj.X = proj.X1, residuals = mod$residuals)$statistic -
rp.flm.statistic(proj.X = proj.X1, residuals = mod$residuals,
F.code = FALSE)$statistic
# Matrix and vector residuals
rp.flm.statistic(proj.X = proj.X12, residuals = mod$residuals)$statistic
rp.flm.statistic(proj.X = proj.X12,
residuals = rbind(mod$residuals, mod$residuals * 2))$statistic
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.