Statistics for testing the functional linear model using random projections
Computes the Cramer-von Mises (CvM) and Kolmogorv-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.
NA
's are not allowed neither in the functional covariate nor in the
scalar response.
rp.flm.statistic(proj.X, residuals, proj.X.ord = NULL, F.code = TRUE)
proj.X |
matrix of size |
residuals |
the residuals of the fitted funtional 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 |
A list containing:
list("statistic") a matrix of size c(n.proj, 2)
with the the CvM (first column) and KS (second)
statistics, for the n.proj
different projections.
list("proj.X.ord")the computed row permutations of proj.X
,
useful for recycling in subsequent calls to rp.flm.statistic
with the
same projections but different residuals.
Eduardo Garcia-Portugues (edgarcia@est-econ.uc3m.es) and Manuel Febrero-Bande (manuel.febrero@usc.es).
Cuesta-Albertos, J.A., Garcia-Portugues, E., Febrero-Bande, M. and Gonzalez-Manteiga, W. (2017). Goodness-of-fit tests for the functional linear model based on randomly projected empirical processes. arXiv:1701.08363. https://arxiv.org/abs/1701.08363
## Not run: # 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 ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.