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
.
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 fosr.perm
plot(x, level = 0.05, xlabel = "", title = NULL, ...)
the functional responses, given as either an Y
or a functional data object (class "fd"
)
as in the fda package.
the design matrix, whose columns represent scalar predictors.
a row vector or matrix of linear contrasts of the coefficient functions, to be restricted to equal zero.
design matrix for the null-hypothesis model. If NULL
, the
null hypothesis is the intercept-only model.
linear constraints for the null-hypothesis model.
the
smoothing parameter value. If NULL
, the smoothing
parameter(s) will be estimated. See fosr
for details.
smoothing parameter for null-hypothesis model.
a logical value indicating whether separate smoothing
parameters should be estimated for each coefficient function. Currently
must be FALSE
if method = "OLS"
.
number of permutations.
significance level for the simultaneous test.
logical value indicating whether to plot the real- and permuted-data pointwise F-type statistics.
x-axis label for plots.
title for plot.
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).
object of class fosr.perm
, outputted by fosr.perm
,
fosr.perm.fit
, or fosr.perm.test
.
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.
pointwise F-type statistics at each of the
points given by argvals
.
a matrix, each of whose rows gives the pointwise F-type statistics for a permuted data set.
points at which F-type statistics are computed.
smoothing parameter(s) for the real-data fit.
smoothing parameter(s) for preliminary permuted-data fits.
smoothing parameter(s) for main permuted-data fits.
as above, but for null hypothesis models.
significance level of the test.
critical value for the test.
vector of
logical values indicating whether significance is attained at each of the
points argvals
.
subset of 1, …,
length(argvals)
identifying the points at which the test statistic
changes from non-significant to significant.
points at which the test statistic changes from significant to non-significant.
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/
# 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)
# }
Run the code above in your browser using DataLab