Learn R Programming

GET (version 0.1-3)

graph.fglm: Graphical functional GLM

Description

Non-parametric graphical tests of significance in functional general linear model (GLM)

Usage

graph.fglm(nsim, formula.full, formula.reduced, curve_sets,
  factors = NULL, summaryfun = c("means", "contrasts"),
  savefuns = FALSE, ..., GET.args = NULL, mc.cores = 1L,
  mc.args = NULL)

Arguments

nsim

The number of random permutations.

formula.full

The formula specifying the general linear model, see formula in lm.

formula.reduced

The formula of the reduced model with nuisance factors only.

curve_sets

A named list of sets of curves giving the dependent variable (Y), and possibly additionally all the factors. The dimensions of the elements should match with each other, i.e. the factor values should be given for each argument value and each function. If factors are given in the argument factors, then can also be just the curve set representing Y. Also fdata objects allowed.

factors

A data frame of factors. An alternative way to specify factors when they are constant for all argument values. The number of rows of the data frame should be equal to the number of curves. Each column should specify the values of a factor.

summaryfun

Possible values are "means" and "contrasts". See description for their meaning.

savefuns

Logical. If TRUE, then the functions from permutations are saved to the attribute simfuns.

...

Additional arguments to be passed to lm.

GET.args

A named list of additional arguments to be passed to global_envelope_test.

mc.cores

The number of cores to use, i.e. at most how many child processes will be run simultaneously. Must be at least one, and parallelization requires at least two cores. On a Windows computer mc.cores must be 1 (no parallelization). For details, see mclapply, for which the argument is passed. Parallelization can be used in generating simulations and in calculating the second stage tests.

mc.args

A named list of additional arguments to be passed to mclapply. Only relevant if mc.cores is more than 1.

Value

A global_envelope or combined_global_envelope object, which can be printed and plotted directly.

Details

The function graph.fglm performs the graphical functional GLM of Mrkvi<U+010D>ka et al. (2019). This is a nonparametric graphical test of significance of a covariate in functional GLM. The test is able to find not only if the factor of interest is significant, but also which functional domain is responsible for the potential rejection. In the case of functional multi-way main effect ANOVA or functional main effect ANCOVA models, the test is able to find which groups differ (and where they differ). In the case of functional factorial ANOVA or functional factorial ANCOVA models, the test is able to find which combination of levels (which interactions) differ (and where they differ). The described tests are global envelope tests applied in the context of GLMs. 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 approximately achieves the desired significance level.

References

Mrkvi<U+010D>ka, T., Roskovec, T. and Rost, M. (2019) A nonparametric graphical tests of significance in functional GLM. arXiv:1902.04926 [stat.ME]

Freedman, D., & Lane, D. (1983) A nonstochastic interpretation of reported significance levels. Journal of Business & Economic Statistics, 1(4), 292-298. doi:10.2307/1391660

Examples

Run this code
# NOT RUN {
data(rimov)
# }
# NOT RUN {
res <- graph.fglm(nsim=19, # Increase the number of simulations for serious analysis!
                  formula.full = Y~Year,
                  formula.reduced = Y~1,
                  curve_sets = list(Y=rimov), factors = data.frame(Year = 1979:2014))
# }
# NOT RUN {
plot(res)

# }
# NOT RUN {
data(GDPtax)
factors.df <- data.frame(Group = GDPtax$Group, Tax = GDPtax$Profittax)
res.tax_within_group <- graph.fglm(nsim = 999,
                                  formula.full = Y~Group+Tax+Group:Tax,
                                  formula.reduced = Y~Group+Tax,
                                  curve_sets = list(Y=GDPtax$GDP),
                                  factors = factors.df)
plot(res.tax_within_group)
# }

Run the code above in your browser using DataLab