Title: | Tests for General Factorial Designs |
---|---|
Description: | Implemented are the Wald-type statistic, a permuted version thereof as well as the ANOVA-type statistic for general factorial designs, even with non-normal error terms and/or heteroscedastic variances, for crossed designs with an arbitrary number of factors and nested designs with up to three factors. Friedrich et al. (2017) <doi:10.18637/jss.v079.c01>. |
Authors: | Sarah Friedrich, Frank Konietschke, Markus Pauly, Marc Ditzhaus, Philipp Steinhauer |
Maintainer: | Sarah Friedrich <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 0.3.3 |
Built: | 2024-11-20 06:40:17 UTC |
Source: | CRAN |
This function provides a graphical user interface for calculating statistical tests in general factorial designs.
calculateGUI()
calculateGUI()
The function produces a GUI for the calculation of the test statistics and for plotting. Data can be loaded via the "load data" button. The formula, number of permutations (default: 10,000) and the significance level alpha (default: 0.05) need to be specified. If the plot option is chosen, an additional window opens containing information on the plots.
A dataset containing the number of flatworms (dugesia) sampled in two seasons at different sites in the Curdies River in Western Victoria.
data(curdies)
data(curdies)
A data frame with 36 rows and 3 variables:
a factor with levels "SUMMER" and "WINTER"
a factor with levels 1 to 6, nested within "season"
number of flatworms counted on a particular stone (in no./dm^2)
https://users.monash.edu.au/~murray/AIMS-R-users/ws/ws7.html
The GFD function calculates the Wald-type statistic (WTS), the ANOVA-type statistic (ATS) as well as a permutation version of the WTS for general factorial designs.
GFD(formula, data = NULL, nperm = 10000, alpha = 0.05, nested.levels.unique = FALSE, CI.method = "t-quantile")
GFD(formula, data = NULL, nperm = 10000, alpha = 0.05, nested.levels.unique = FALSE, CI.method = "t-quantile")
formula |
A model |
data |
A data.frame, list or environment containing the variables in
|
nperm |
The number of permutations used for calculating the permuted Wald-type statistic. The default option is 10000. |
alpha |
A number specifying the significance level; the default is 0.05. |
nested.levels.unique |
A logical specifying whether the levels of the nested factor(s) are labeled uniquely or not. Default is FALSE, i.e., the levels of the nested factor are the same for each level of the main factor. |
CI.method |
Method for calculating the confidence intervals. Default is 't-quantile' for CIs based on the corresponding t-quantile. Additionally, the quantile of the permutation distribution can be used ('perm'). |
The package provides the Wald-type statistic, a permuted version
thereof as well as the ANOVA-type statistic for general factorial designs,
even with non-normal error terms and/or heteroscedastic variances. It is
implemented for both crossed and hierarchically nested designs and allows
for an arbitrary number of factor combinations as well as different sample
sizes in the crossed design.
The GFD
function returns three p-values: One for the ATS based on an F-quantile and
two for the WTS, one based on the
distribution and one based on the permutation procedure.
Since the ATS is only an approximation and the WTS based on the
distribution is known
to be very liberal for small sample sizes, we recommend to use the WTPS in these situations.
A GFD
object containing the following components:
Descriptive |
Some descriptive statistics of the data for all factor level combinations. Displayed are the number of individuals per factor level combination, the mean, variance and 100*(1-alpha)% confidence intervals. |
WTS |
The value of the WTS along with degrees of freedom of the central chi-square distribution and p-value, as well as the p-value of the permutation procedure. |
ATS |
The value of the ATS, degrees of freedom of the central F distribution and the corresponding p-value. |
Friedrich, S., Konietschke, F., Pauly, M.(2017). GFD - An R-package for the Analysis of General Factorial Designs. Journal of Statistical Software, Code Snippets 79(1), 1–18, doi:10.18637/jss.v079.c01.
Pauly, M., Brunner, E., Konietschke, F.(2015). Asymptotic Permutation Tests in General Factorial Designs. Journal of the Royal Statistical Society - Series B 77, 461-473.
data(startup) model <- GFD(Costs ~ company, data = startup, CI.method = "perm") summary(model)
data(startup) model <- GFD(Costs ~ company, data = startup, CI.method = "perm") summary(model)
This function provides a shiny app for calculating GFD and QANOVA test statistics and respective p-values.
GFD_GUI()
GFD_GUI()
Philipp Steinhauer
A dataset containing the delivery times for pizza (in minutes) under different conditions.
data(pizza)
data(pizza)
A data frame with 16 rows and 6 variables:
a factor with levels "thick" and "thin"
whether or not Coke was ordered with the pizza ("yes" or "no")
whether or not garlic bread was ordered with the pizza ("yes" or "no")
the sex of the driver, a factor with levels "M" and "F"
time of order in hours after midnight
Delivery time in minutes
http://www.statsci.org/data/oz/pizza.html
The function qanova
calculates the Wald-type statistic based on the
quantiles and/or their linear combinations, e.g. the interquartile range. Respective p-values
are obtained by a -approximation and a permutation approach, respectively.
QANOVA(formula, data = NULL, quantiles = c(0.5), lin_mat = NULL, var_method = "interval", nperm = 1999, var_level = 0.95, nested.levels.unique = FALSE)
QANOVA(formula, data = NULL, quantiles = c(0.5), lin_mat = NULL, var_method = "interval", nperm = 1999, var_level = 0.95, nested.levels.unique = FALSE)
formula |
A model |
data |
A data.frame, list or environment containing the variables in formula
and the censoring status
indicator. Default option is |
quantiles |
A vector of probabilties corresponding to the quantiles of interest. By default is c(0.5), i.e. just the median is included. |
lin_mat |
A matrix specifying which linear combination of the quantiles should be
included for the analysis. By default ( |
var_method |
Method for the variance estimation of the sample quantiles. The default ("interval") is the interval-based estimator of Price and Bonett (2001). Additionally, the bootstrap method ("boot") of Efron (1987) or a kernel density approach ("kernel") can be chosen. |
nperm |
The number of permutations used for calculating the permuted p-value. The default option is 1999. |
var_level |
A number between 0 and 1 specifying the confidence level for the interval variance estimation method; the default value is 0.95. |
nested.levels.unique |
A logical specifying whether the levels of the nested factor(s) are labeled uniquely or not. Default is FALSE, i.e., the levels of the nested factor are the same for each level of the main factor. |
The qanova
function calculates the Wald-type statistic based on quantiles
and linear combinations of them for general factorial designs. The procedure is fully
nonparametric and no specific assumption of the underlying distribution is required.
In particular, heteroscedastic settings can be studied. The analysis can be based on a single
quantile (e.g. the median, default choice), a linear combination of quantiles (e.g. the
interquartile range, set quantiles=c(0.25,0.75)
and lin_mat = matrix(c(-1,1),ncol=2)
)
or on several (combinations of) quantiles simulatenously.
The qanova
function returns the test statistic as well as two
corresponding p-values: the first is based on a approximation and
the second one is based on a permutation procedure.
@return A qanova
object containing the following components:
pvalues_statThe p-values obtained by -approximation
pvalues_perThe p-values of the permutation approach
statisticsThe value of the qanova along with degrees of freedom of the central chi-square distribution and p-value, as well as the p-value of the permutation procedure.
npermThe number of permutations used for calculating the permuted p-value.
Philipp Steinhauer
Ditzhaus, M., Fried, R. and Pauly, M. (2021). QANOVA: Quantile-based Permutation Methods For General Factorial Designs. TEST (to appear, ArXiv preprint arXiv:1912.09146). Efron, B. (1979). Bootstrap methods: Another look at the jackknife. Ann. Statist., 7:1-26. Price, R. and Bonett, D. (2001). Estimating the variance of the sample median. J. Stat. Comput. Simul, 68:295-305.
QANOVA(weightgain ~ source*type, data = HSAUR::weightgain,var_method = "interval", nperm =199)
QANOVA(weightgain ~ source*type, data = HSAUR::weightgain,var_method = "interval", nperm =199)
A dataset containing the startup costs (in thousands of dollars) of five companies.
data(startup)
data(startup)
A data frame with 60 rows and 2 variables:
price, in thousands of dollars
company, a factor with levels "pets", "pizza", "gifts", "shoes" and "bakery"