The function frank.flm performs
a nonparametric test of significance of a covariate in the functional GLM.
Similarly as in the graphical functional GLM (graph.flm),
the Freedman-Lane algorithm (Freedman and Lane, 1983) is applied to permute the functions
(to obtain the simulations under the null hypothesis of "no effects");
consequently, the test achieves the desired significance level only approximately.
If the reduced model contains only a constant, then the algorithm corresponds to
simple permutation of raw data.
In contrast to the graphical functional GLM, the F rank functional GLM is based on the
F-statistics that are calculated at each argument value of the functions.
The global envelope test is applied to the observed and simulated F-statistics.
The test is able to find if the factor of interest is significant and also which
argument values of the functional domain are responsible for the potential rejection.
The specification of the full and reduced formulas is important. The reduced model should be
nested within the full model. The full model should include in addition to the reduced
model the interesting factors whose effects are under investigation.
There are different versions of the implementation depending on the application.
If all the covariates are constant across the functions, i.e. they can be provided in the
argument factors, and there are no extra arguments given by the user in lm.args, then a
fast implementation is used to directly compute the F-statistics.
If all the covariates are constant across the functions, but there are some extra arguments,
then a linear model is fitted separately by least-squares estimation to
the data at each argument value of the functions fitting a multiple linear model by lm.
The possible extra arguments passed in lm.args to lm must be of the form that
lm accepts for fitting a multiple linear model. In the basic case, no extra arguments are
needed.
If some of the covariates vary across the space, i.e. they are provided in the list of curve sets in
the argument curve_sets together with the dependent functions, but there are no extra arguments given
by the user in lm.args, there is a rather fast implementation of the F-value calculation (which does not
use lm).
If some of the covariates vary across the space and there are user specified extra arguments given in
lm.args, then the implementation fits a linear model at each argument value of the functions using
lm, which can be rather slow. The arguments lm.args are passed to lm
for fitting each linear model.
By default the fastest applicable method is used. This can be changed by setting method argument.
The cases above correspond to "simple", "mlm", "complex" and "lm". Changing the default can be useful for
checking the validity of the implementation.