Learn R Programming

refund (version 0.1-11)

fosr.perm: Permutation testing for function-on-scalar regression

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

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 = 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=.05)

## S3 method for class 'fosr.perm':
plot(x, level = .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.
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.
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.
x
object of class fosr.perm, outputted by fosr.perm, fosr.perm.fit, or fosr.perm.test.
...
for fosr.perm and fosr.perm.fit, additional arguments passed to fosr. These arguments may include max.iter, method, gam.method, and scale

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.
  • Fpointwise F-type statistics at each of the points given by argvals.
  • F.perma matrix, each of whose rows gives the pointwise F-type statistics for a permuted data set.
  • argvalspoints at which F-type statistics are computed.
  • lambda.realsmoothing parameter(s) for the real-data fit.
  • lambda.prelimsmoothing parameter(s) for preliminary permuted-data fits.
  • lambda.permsmoothing parameter(s) for main permuted-data fits.
  • lambda0.real, lambda0.prelim, lambda0.permas above, but for null hypothesis models.
  • levelsignificance level of the test.
  • critvalcritical value for the test.
  • signifvector of logical values indicating whether significance is attained at each of the points argvals.
  • n2ssubset of {1, ..., length(argvals)} identifying the points at which the test statistic changes from non-significant to significant.
  • s2npoints at which the test statistic changes from significant to non-significant.

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 http://works.bepress.com/phil_reiss/16/

See Also

fosr

Examples

Run this code
# 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)

Run the code above in your browser using DataLab