KKSA_test | R Documentation |

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 )

`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 *a ≥ b* and *b ≥ 4*. Consider the *l*-th division of the data table into two sub-tables,
obtained by putting *a_1* (*2 ≤ a_1 ≤ a-2*) rows in the first sub-table and the remaining *a_2* rows in the second sub-table (*a_1+a_2=a*).
Let RSS1 and RSS2 denote the residual sum of squares for these two sub-tables, respectively. For a particular division *l*, let *F_l=max\{F_l,1/F_l\}*
where *F_l=(a_2-1)RSS1/((a_1-1)RSS2)* and let *P_l* denote the corresponding p-value.
Kharrati-Kopaei and Sadooghi-Alvandi (2007) proposed their test statistic as the minimum value of *P_l* over *l=1,…,2^{(a-1)}-a-1* 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)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.