fosr.perm: Permutation testing for function-on-scalar regression In refund: Regression with Functional Data

Description

fosr.perm() is a wrapper function calling fosr.perm.fit(), which fits models to permuted data, followed by fosr.perm.test(), which performs the actual simultaneous hypothesis test. Calling the latter two functions separately may be useful for performing tests at different significance levels. By default, fosr.perm() produces a plot using the plot function for class fosr.perm.

Usage

 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 fosr.perm( Y = NULL, fdobj = NULL, X, con = NULL, X0 = NULL, con0 = NULL, argvals = NULL, lambda = NULL, lambda0 = NULL, multi.sp = FALSE, nperm, level = 0.05, plot = TRUE, xlabel = "", title = NULL, prelim = if (multi.sp) 0 else 15, ... ) fosr.perm.fit( Y = NULL, fdobj = NULL, X, con = NULL, X0 = NULL, con0 = NULL, argvals = NULL, lambda = NULL, lambda0 = NULL, multi.sp = FALSE, nperm, prelim, ... ) fosr.perm.test(x, level = 0.05) ## S3 method for class 'fosr.perm' plot(x, level = 0.05, xlabel = "", title = NULL, ...)

Arguments

 Y, fdobj the functional responses, given as either an n\times d matrix Y or a functional data object (class "fd") as in the fda package. X the design matrix, whose columns represent scalar predictors. con a row vector or matrix of linear contrasts of the coefficient functions, to be restricted to equal zero. X0 design matrix for the null-hypothesis model. If NULL, the null hypothesis is the intercept-only model. con0 linear constraints for the null-hypothesis model. argvals the d argument values at which the coefficient functions will be evaluated. lambda smoothing parameter value. If NULL, the smoothing parameter(s) will be estimated. See fosr for details. lambda0 smoothing parameter for null-hypothesis model. multi.sp a logical value indicating whether separate smoothing parameters should be estimated for each coefficient function. Currently must be FALSE if method = "OLS". nperm number of permutations. level significance level for the simultaneous test. plot logical value indicating whether to plot the real- and permuted-data pointwise F-type statistics. xlabel x-axis label for plots. title title for plot. prelim number of preliminary permutations. The smoothing parameter in the main permutations will be fixed to the median value from these preliminary permutations. If prelim=0, this is not done. Preliminary permutations are not available when multi.sp = TRUE (hence the complicated default). ... for fosr.perm and fosr.perm.fit, additional arguments passed to fosr. These arguments may include max.iter, method, gam.method, and scale. For plot.fosr.perm, graphical parameters (see par) for the plot. x object of class fosr.perm, outputted by fosr.perm, fosr.perm.fit, or fosr.perm.test.

Value

fosr.perm or fosr.perm.test produces an object of class fosr.perm, which is a list with the elements below. fosr.perm.fit also outputs an object of this class, but without the last five elements.

 F pointwise F-type statistics at each of the points given by argvals. F.perm a matrix, each of whose rows gives the pointwise F-type statistics for a permuted data set. argvals points at which F-type statistics are computed. lambda.real smoothing parameter(s) for the real-data fit. lambda.prelim smoothing parameter(s) for preliminary permuted-data fits. lambda.perm smoothing parameter(s) for main permuted-data fits. lambda0.real, lambda0.prelim, lambda0.perm as above, but for null hypothesis models. level significance level of the test. critval critical value for the test. signif vector of logical values indicating whether significance is attained at each of the points argvals. n2s subset of 1, ..., length(argvals) identifying the points at which the test statistic changes from non-significant to significant. s2n points at which the test statistic changes from significant to non-significant.

Author(s)

Philip Reiss phil.reiss@nyumc.org and Lan Huo

References

Reiss, P. T., Huang, L., and Mennes, M. (2010). Fast function-on-scalar regression with penalized basis expansions. International Journal of Biostatistics, 6(1), article 28. Available at https://pubmed.ncbi.nlm.nih.gov/21969982/

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ## Not run: # Test effect of region on mean temperature in the Canadian weather data # The next two lines are taken from the fRegress.CV help file (package fda) smallbasis <- create.fourier.basis(c(0, 365), 25) tempfd <- smooth.basis(day.5, CanadianWeather$dailyAv[,,"Temperature.C"], smallbasis)$fd Xreg = cbind(1, model.matrix(~factor(CanadianWeather\$region)-1)) conreg = matrix(c(0,1,1,1,1), 1) # constrain region effects to sum to 0 # This is for illustration only; for a real test, must increase nperm # (and probably prelim as well) regionperm = fosr.perm(fdobj=tempfd, X=Xreg, con=conreg, method="OLS", nperm=10, prelim=3) # Redo the plot, using axisIntervals() from the fda package plot(regionperm, axes=FALSE, xlab="") box() axis(2) axisIntervals(1) ## End(Not run)