Learn R Programming

refund (version 0.1-6)

wcr.perm: Permutation test for principal component regression and partial least squares in the wavelet domain

Description

This function assesses statistical significance of a wcr fit by referring the cross-validation criterion to a permutation distribution.

Usage

wcr.perm(y, xfuncs, min.scale, nfeatures, ncomp, method = c("pcr", "pls"), 
         covt = NULL, nperm = 20, perm.method = "responses", ...)

Arguments

y,xfuncs,min.scale,nfeatures,ncomp,method,covt
arguments passed to wcr.
nperm
number of permutations. The default is set to a very low value in view of the .
perm.method
one of
  • "responses": permute the response vectory.
"y.residuals": permute the residuals upon regressing y ~ covt. "x.residuals": permute the residuals

Value

  • cvthe CV criterion for the real data.
  • cv.permthe CV values for the permuted data.
  • pvaluethe p-value for the permutation test.

item

...

code

wcr

Details

Permutation tests of this type are discussed, in a classification setting, by Ojala and Garriga (2010). Permuting the responses is appropriate when regressing on functions/images only, with no scalar covariates. For linear regression with covariates, it is preferable to first regress on the covariates, and then permute the residuals. For logistic regression this is not feasible; but, following Potter (2005), one can instead permute the residuals from a regression of the functions/images on the covariates.

References

Ojala, M., and Garriga, G. C. (2010). Permutation tests for studying classifier performance. Journal of Machine Learning Research, 11, 1833--1863. Potter, D. M. (2005). A permutation test for inference in logistic regression with small- and moderate-sized data sets. Statistics in Medicine, 24, 693--708.

See Also

wcr

Examples

Run this code
n = 200; d = 64

# Create true coefficient function
ftrue = matrix(0,d,d)
ftrue[40:46,34:38] = 1

# Generate random functional predictors, and scalar responses
ii = array(rnorm(n*d^2), dim=c(n,d,d))
iimat = ii; dim(iimat) = c(n,d^2)
yy = iimat %*% as.vector(ftrue) + rnorm(n, sd=.3)

cv.obj <- wcr.perm(yy, xfuncs = ii, min.scale = 4, nfeatures = 20, ncomp = 6, cv1 = TRUE,
                   method = "pls", nperm = 10)
hist(cv.obj$cv.perm, xlab = "CV", main = "permutation test", xlim = range(c(cv.obj$cv, cv.obj$cv.perm)))
abline(v = cv.obj$cv, col = "red")

Run the code above in your browser using DataLab