Title: | A Combined Interaction Test for Unreplicated Two-Way Tables |
---|---|
Description: | There are several non-functional-form-based interaction tests for testing interaction in unreplicated two-way layouts. However, no single test can detect all patterns of possible interaction and the tests are sensitive to a particular pattern of interaction. This package combines six non-functional-form-based interaction tests for testing additivity. These six tests were proposed by Boik (1993) <doi:10.1080/02664769300000004>, Piepho (1994), Kharrati-Kopaei and Sadooghi-Alvandi (2007) <doi:10.1080/03610920701386851>, Franck et al. (2013) <doi:10.1016/j.csda.2013.05.002>, Malik et al. (2016) <doi:10.1080/03610918.2013.870196> and Kharrati-Kopaei and Miller (2016) <doi:10.1080/00949655.2015.1057821>. The p-values of these six tests are combined by Bonferroni, Sidak, Jacobi polynomial expansion, and the Gaussian copula methods to provide researchers with a testing approach which leverages many existing methods to detect disparate forms of non-additivity. This package is based on the following published paper: Shenavari and Kharrati-Kopaei (2018) "A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests". In addition, several sentences in help files or descriptions were copied from that paper. |
Authors: | Zahra Shenavari [aut], Hossein Haghbin [aut, cre] , Mahmood Kharrati-Kopaei [aut] , Seyed Morteza Najibi [aut] |
Maintainer: | Hossein Haghbin <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.0.0 |
Built: | 2024-10-30 03:45:07 UTC |
Source: | https://github.com/haghbinh/combinit |
This function calculates the LBI test statistic for testing the null hypothesis There is no interaction.
It returns an exact p-value when
where
. It returns an exact Monte Carlo p-value when
. It also provides an asymptotic chi-squared p-value. Note that the p-value of the Boik.test is always one when
.
Boik_test(x, nsim = 10000, alpha = 0.05, report = TRUE)
Boik_test(x, nsim = 10000, alpha = 0.05, report = TRUE)
x |
a numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for calculating an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
The LBI test statistic is where
and
is the residual
matrix of the input data matrix,
, under the null hypothesis
There is no interaction. This test rejects the null hypothesis of no interaction when
is small.
Boik (1993) provided the exact distribution of
when
under
. In addition, he provided an asymptotic distribution of
under
when
tends to infinity where
.
Note that the LBI test is powerful when the
matrix of interaction terms has small rank and one singular value dominates the remaining singular values or
in practice, if the largest eigenvalue of
is expected to dominate the remaining eigenvalues.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
An exact Monte Carlo p-value when |
pvalue_appro |
An chi-squared asymptotic p-value. |
statistic |
The value of test statistic. |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Boik, R.J. (1993). Testing additivity in two-way classifications with no replications: the locally best invariant test. Journal of Applied Statistics 20(1): 41-55.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(MVGH) Boik_test(MVGH, nsim = 1000)
data(MVGH) Boik_test(MVGH, nsim = 1000)
This function reports the p-values of the tests for non-additivity developed by Boik (1993), Piepho (1994), Kharrati-Kopaei and Sadooghi-Alvandi (2007), Franck et al. (2013), Malik et al. (2016) and Kharrati-Kopaei and Miller (2016). In addition, it combines the p-values of these six tests (and some other available p-values) into a single p-value as a test statistic for testing interaction. There are four combination methods: Bonferroni, Sidak, Jacobi expansion, and Gaussian Copula. The results of these four combined tests are also reported. If there is a significant interaction, the type of interaction is also provided.
CI_test( x, nsim = 10000, nc0 = 10000, opvalue = NULL, alpha = 0.05, report = TRUE, Elapsed_time = TRUE )
CI_test( x, nsim = 10000, nc0 = 10000, opvalue = NULL, alpha = 0.05, report = TRUE, Elapsed_time = TRUE )
x |
numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
nc0 |
a numeric value, the number of Monte Carlo samples for computing the unbiasing constant |
opvalue |
a numeric vector, other p-values (in addition to the six considered p-values) that are going to be combined. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
Elapsed_time |
logical: if |
The data matrix is divided based on the row of the data matrix for KKSA_test
and Franck_test
. Note that KKSA_test
is not applicable when is less than four.
Franck_test
and Piepho_test
are not applicable when is less than three. This function needs
mvtnorm
package.
An object of the class combtest
, which is a list inducing following components:
nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
Piepho_pvalue |
The p-value of Piepho's (1994) test. |
Piepho_Stat |
The value of Piepho's (1994) test statistic. |
Boik_pvalue |
The p-value of Boik's (1993) test. |
Boik_Stat |
The value of Boik's (1993) test statistic. |
Malik_pvalue |
The p-value of Malik's (2016) et al. test. |
Malik_Stat |
The value of Malik's (2016) et al. test statistic. |
KKM_pvalue |
The p-value of Kharrati-Kopaei and Miller's (2016) test. |
KKM_Stat |
The value of Kharrati-Kopaei and Miller's (2016) test statistic. |
KKSA_pvalue |
The p-value of Kharrati-Kopaei and Sadooghi-Alvandi's (2007) test. |
KKSA_Stat |
The value of Kharrati-Kopaei and Sadooghi-Alvandi's (2007) test statistic. |
Franck_pvalue |
The p-value of Franck's (2013) et al. test. |
Franck_Stat |
The value of Franck's (2013) et al. test statistic. |
Bonferroni |
The combined p-value by using the Bonferroni method. |
Sidak |
The combined p-value by using the Sidak method. |
Jacobi |
The combined p-value by using the Jacobi method. |
GC |
The combined p-value by using the Gaussian copula. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the combined test at the alpha level with some descriptions on the type of significant interaction. |
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(CNV) CI_test(CNV, nsim = 1000, Elapsed_time = FALSE)
data(CNV) CI_test(CNV, nsim = 1000, Elapsed_time = FALSE)
This data set are about copy number variation (CNV) between normal and tumor tissue samples among six dogs. In this data set, the value of CNV was measured as a signal intensity obtained from a comparative genomic hybridization (CGH) array, with higher signals corresponding to higher copy numbers; see Franck et al. (2013) and Franck and Osborne (2016). The data set was selected from 5899 sets (the full data have been made available as the supplementary material of the paper published by Franck et al. (2013)). The test of interaction between the dogs and tisuues is of interest.
A matrix with six rows (Dogs) and two columns (Tissues):
Dog1
Dog2
Dog3
Dog4
Dog5
Dog6
Normal tissue
Tumor
Franck, C., Nielsen, D., Osborne, J.A. (2013). A method for detecting hidden additivity in two-factor unreplicated experiments. Computational Statistics and Data Analysis 67:95-104.
Franck, C., Osborne, J.A. (2016). Exploring Interaction Effects in Two-Factor Studies using the hidden Package in R. R Journal 8 (1):159-172.
This function calculates Franck's (2013) et al. test statistic, ACMIF, and corresponding p-value.
Franck_test( x, nsim = 10000, alpha = 0.05, report = TRUE, plot = FALSE, vecolor = c("blue", "red"), linetype = c(1, 2), Elapsed_time = TRUE )
Franck_test( x, nsim = 10000, alpha = 0.05, report = TRUE, plot = FALSE, vecolor = c("blue", "red"), linetype = c(1, 2), Elapsed_time = TRUE )
x |
numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
plot |
logical: if |
vecolor |
character vector of length two, for visualizing the colors of lines in interaction plot. The default colors are blue and red. |
linetype |
numeric vector of length two, for visualizing the line types in interaction plot. The default line types are 1 and 2. |
Elapsed_time |
logical: if |
Franck et al. (2013) derived a test statistic based on the “hidden additivity” structure.
They defined this structure as “the levels of one factor belong in two or more groups such that within each group the effects of the two factors are additive but the groups may interact with the ungrouped factor”.
To detect hidden additivity, Franck et al. (2013) divided the table of data into two sub-tables (based on the rows of the data matrix) and an interaction F-test was developed.
Then, they performed a search over all possible configures of data and used the maximum of the interaction F-test as a test statistic. The hypothesis of no interaction is rejected when the maximum interaction F-test is large.
If plot
is TRUE
an interaction plot will be plotted by displaying levels of column factor on the horizontal axis,
levels of row factor using lines that are visually distinguished by line type and color, and the
observed values on the vertical axis. Color and line type are used to display which levels of row factor are assigned to which
groups based on the maximum F-values among all possible configurations. Note
that the grouping colors and line types appear whether or not the Franck.test detects
a significant non-additivity. The default colors are blue and red, and the default line types are one and two for the two groups. They can be customized by supplying arguments called vecolor
and linetype
.
Note that the number of rows should be greater than two to perform the Franck.test. This test is powerful when there is a hidden additivity structure in the data set.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
The calculated exact Monte Carlo p-value. |
pvalue_appro |
The Bonferroni-adjusted p-value is calculated. |
statistic |
The value of the test statistic. |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Franck, C., Nielsen, D., Osborne, J.A. (2013). A method for detecting hidden additivity in two-factor unreplicated experiments. Computational Statistics and Data Analysis 67:95-104.
Franck, C., Osborne, J.A. (2016). Exploring Interaction Effects in Two-Factor Studies using the hidden Package in R. R Journal 8 (1):159-172.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(CNV) Franck_test(CNV, nsim = 1000, Elapsed_time = FALSE)
data(CNV) Franck_test(CNV, nsim = 1000, Elapsed_time = FALSE)
This data were collected in an experiment to assess the impurity present in a chemical product. The impurity is affected by two factors: pressure and temperature. Montgomery (2001, p. 193) analyzed the data by using the Tukey single-degree-of-freedom test and concluded that there is no evidence of interaction.
A matrix with five rows (Pressures) and three columns (Temperatures):
Pressure 25
Pressure 30
Pressure 35
Pressure 40
Pressure45
Temperature 100
Temperature 125
Temperature 150
Montgomery, D. C. (2001). Design and analysis of experiments, 5th Edition, p 193. John Wiley & Sons.
Interaction Plot
interaction_plot(x, ...)
interaction_plot(x, ...)
x |
numeric matrix, |
... |
plot parameters |
Plots an interaction plot for input.
Shenavari, Z.; Haghbin, H.; Kharrati-Kopaei, M.; Najibi, S.M.
## Not run: this is an example data(CNV) interaction_plot(CNV)
## Not run: this is an example data(CNV) interaction_plot(CNV)
This function calculates the test statistic for testing There is no interaction, and corresponding Monte Carlo p-value
proposed by Kharrati-Kopaei and Miller (2016).
KKM_test(x, nsim = 1000, alpha = 0.05, report = TRUE, nc0 = 10000)
KKM_test(x, nsim = 1000, alpha = 0.05, report = TRUE, nc0 = 10000)
x |
a numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
nc0 |
a numeric value, the number of Monte Carlo samples for computing the unbiasing constant |
Kharrati-Kopaei and Miller (2016) proposed a test statistic for testing interaction
based on inspecting all pairwise interaction contrasts (PIC).
This test depends on an unbiasing constant that is calculated by a Monte Carlo simulation.
In addition, the null distribution of the test statistic is calculated by a Monte Carlo simulation. This test is not applicable when both
and
are less than three.
Note that this test procedure is powerful when significant interactions are caused by some data cells.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
The calculated exact Monte Carlo p-value. |
pvalue_appro |
is not available for |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
statistic |
The value of the test statistic. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Kharrati-Kopaei, M., Miller, A. (2016). A method for testing interaction in unreplicated two-way tables: using all pairwise interaction contrasts. Statistical Computation and Simulation 86(6):1203-1215.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(RDWW) KKM_test(RDWW, nsim = 1000, nc0 = 1000)
data(RDWW) KKM_test(RDWW, nsim = 1000, nc0 = 1000)
This function calculates Kharrati-Kopaei and Sadooghi-Alvandi's test statistic and corresponding p-value for testing interaction.
KKSA_test( x, nsim = 10000, alpha = 0.05, report = TRUE, plot = FALSE, vecolor = c("blue", "red"), linetype = c(1, 2), Elapsed_time = TRUE )
KKSA_test( x, nsim = 10000, alpha = 0.05, report = TRUE, plot = FALSE, vecolor = c("blue", "red"), linetype = c(1, 2), Elapsed_time = TRUE )
x |
numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
plot |
logical: if |
vecolor |
character vector with length two, for visualizing the colors of lines in interaction plot. The default colors are blue and red. |
linetype |
numeric vector with length two, for visualizing the line types in interaction plot. The default line types are 1 and 2. |
Elapsed_time |
logical: if |
Suppose that and
. Consider the
-th division of the data table into two sub-tables,
obtained by putting
(
) rows in the first sub-table and the remaining
rows in the second sub-table (
).
Let RSS1 and RSS2 denote the residual sum of squares for these two sub-tables, respectively. For a particular division
, let
where
and let
denote the corresponding p-value.
Kharrati-Kopaei and Sadooghi-Alvandi (2007) proposed their test statistic as the minimum value of
over
all possible divisions of the table.
If
plot
is TRUE
an interaction plot will be plotted by displaying levels of column factor on the horizontal axis,
levels of row factor using lines that are visually distinguished by line type and color, and the
observed values on the vertical axis. Color and line type are used to display which levels of row factor are assigned to which
sub-tables based on the minimum p-values among all possible configurations. Note
that the grouping colors and line types appear whether or not the KKSA.test detects
a significant non-additivity. The default colors are blue and red, and the default line types are one and two for the two sub-tables. They can be customized by supplying arguments called vecolor
and linetype
.
Note that this method of testing requires that the data matrix has more than three
rows. This test procedure is powerful for detecting interaction when the magnitude of interaction effects is heteroscedastic across the sub-tables of observations.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
The calculated exact Monte Carlo p-value. |
pvalue_appro |
The Bonferroni-adjusted p-value is calculated. |
statistic |
The value of the test statistic. |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Kharrati-Kopaei, M., Sadooghi-Alvandi, S.M. (2007). A New Method for Testing Interaction in Unreplicated Two-Way Analysis of Variance. Communications in Statistics-Theory and Methods 36:2787–2803.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(IDCP) KKSA_test(IDCP, nsim = 1000, Elapsed_time = FALSE)
data(IDCP) KKSA_test(IDCP, nsim = 1000, Elapsed_time = FALSE)
The Malik's (2016) et al. test statistic is calculated and the corresponding exact p-value is calculated by a Monte Carlo simulation.
Malik_test(x, nsim = 10000, alpha = 0.05, report = TRUE, Elapsed_time = TRUE)
Malik_test(x, nsim = 10000, alpha = 0.05, report = TRUE, Elapsed_time = TRUE)
x |
numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
Elapsed_time |
logical: if |
Malik (2016) et al. proposed to partition
the residuals into three clusters using a suitable clustering method like “k-means clustering”.
The hypothesis of no interaction can be interpreted as the effect of the three
clusters are equal. Therefore, the result of the test may depend on the method of clustering. In this package, clustering is done by kmeans
function in RcppArmadillo
. The speed_mode
parameter on the kmeans clustering was set as static_subset
.
Note that the Malik's et al. test performs well when there are some outliers in the residuals; i.e. some cells produce large negative or positive residuals due to the significant interaction.
Further, the distribution of the Malik's et al. test statistic is not known under additivity and the corresponding p-value is calculated by a Monte Carlo simulation.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
The calculated exact Monte Carlo p-value. |
pvalue_appro |
is not available for |
statistic |
The value of the test statistic. |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Malik, W.A., Mohring, J., Piepho, H.P. (2016). A clustering-based test for non-additivity in an unreplicated two-way layout. Communications in Statistics-Simulation and Computation 45(2):660-670.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
data(IDCP) Malik_test(IDCP, nsim = 1000, Elapsed_time = FALSE)
data(IDCP) Malik_test(IDCP, nsim = 1000, Elapsed_time = FALSE)
This data set are about the mean values of growth hormone for the levels of zinc and thyroid hormone obtained by Freake et al. (2001). This data set has been previously analyzed by Alin and Kurt (2006). There three levels of zinc: Zinc deficient, Pair-fed, and Control. There are also three levels of thyroid hormone: Hypothyroid, Euthyroid, and Hyperthyroid. The test of interaction between the zinc and thyroid hormone is of interest.
A matrix with three rows (Thyroid levels) and three columns (Zinc levels):
Hypothyroid
Euthyroid
Hyperthyroid
.
Zinc deficient
Pair-fed
Control
Alin, A., Kurt, S. (2006). Testing non-additivity (interaction) in two-way ANOVA tables with no replication, Statistical Methods in Medical Research 15: 63–85.
Freake, H. C., Govoni, K. E., Guda, K., Huang, C, Zinn, S. A. (2001). Actions and interactions of thyroid hormone and zinc status in growing rats. Journal of Nutrition 131:1135–41.
This function tests the interaction based on a statistic proposed by Piepho (1994). This function reports Piepho's test statistic, an asymptotic p-value, and a Monte Carlo p-value.
Piepho_test(x, nsim = 10000, alpha = 0.05, report = TRUE)
Piepho_test(x, nsim = 10000, alpha = 0.05, report = TRUE)
x |
numeric matrix, |
nsim |
a numeric value, the number of Monte Carlo samples for computing an exact Monte Carlo p-value. The default value is 10000. |
alpha |
a numeric value, the level of the test. The default value is 0.05. |
report |
logical: if |
Piepho (1994) proposed three test statistics. The third one is based on Grubbs’ (1948) type estimator of variance for the level of the row factor. This type of estimator is used in this function. Piepho (1994) proposed an asymptotic distribution of test statistic; however, a Monte Carlo method is used to calculate the p-value. The Piepho test is not applicable when the row number of the data matrix is less than three. Note that Piepho’s test is powerful for detecting interactions when the Grubbs’ type estimators of variances are heterogeneous across the levels of one factor.
An object of the class ITtest
, which is a list inducing following components:
pvalue_exact |
The calculated exact Monte Carlo p-value. |
pvalue_appro |
The asymptotic p-value. |
statistic |
The value of the test statistic. |
Nsim |
The number of Monte Carlo samples that are used to estimate p-value. |
data_name |
The name of the input dataset. |
test |
The name of the test. |
Level |
The level of test. |
Result |
The result of the test at the alpha level with some descriptions on the type of significant interaction. |
Piepho, H. P. (1994). On Tests for Interaction in a Nonreplicated Two-Way Layout. Australian Journal of Statistics 36:363-369.
Shenavari, Z., Kharrati-Kopaei, M. (2018). A Method for Testing Additivity in Unreplicated Two-Way Layouts Based on Combining Multiple Interaction Tests. International Statistical Review 86(3): 469-487.
Grubbs, F.E. (1948). On Estimating Precision of Measuring Instruments and Product Variability. Journal of the American Statistical Association 43(242): 243-264.
data(MVGH) Piepho_test(MVGH, nsim = 1000)
data(MVGH) Piepho_test(MVGH, nsim = 1000)
This data set are about the ratio of dry to wet wheat of four different blocks and four times of nitrogen applied: None, Early, Middle, and Late. The test of interaction between the blocks and the level of nitrogen applied is of interest.
A matrix with four rows (Blocks) and four columns (Nitrogen Applied):
Block1
Block2
Block3
Block4
None
Early
Middle
Late
Ostle, B. (1963). Statistics in Research, Basic Concepts and Techniques for Research Works. 2nd ed, p. 396. The Iowa State University Press.