# citest-ordinal: A function to compute Monte Carlo and asymptotic tests of... In gRim: Graphical Interaction Models

## Description

The function computes tests of independence of two variables, say u and v, given a set of variables, say S. The deviance, Wilcoxon, Kruskal-Wallis and Jonkheere-Terpstra tests are supported. Asymptotic and Monte Carlo p-values are computed.

## Usage

 `1` ```ciTest_ordinal(x, set = NULL, statistic = "dev", N = 0, ...) ```

## Arguments

 `x` A dataframe or table. `set` The variable set (u,v,S), given either as an integer vector of the column numbers of a dataframe or dimension numbers of a table, or as a character vector with the corresponding variable or dimension names. `statistic` Either "deviance", "wilcoxon", "kruskal" or "jt". `N` The number of Monte Carlo samples. If N<=0 then Monte Carlo p-values are not computed. `...` Additional arguments, currently not used

## Details

The deviance test is appropriate when u and v are nominal; Wilcoxon, when u is binary and v is ordinal; Kruskal-Wallis, when u is nominal and v is ordinal; Jonckheere-Terpstra, when both u and v are ordinal.

## Value

A list including the test statistic, the asymptotic p-value and, when computed, the Monte Carlo p-value.

 `P` Asymptotic p-value `montecarlo.P` Monte Carlo p-value

## Author(s)

Flaminia Musella, David Edwards, Søren Højsgaard, sorenh@math.aau.dk

## References

See Edwards D. (2000), "Introduction to Graphical Modelling", 2nd ed., Springer-Verlag, pp. 130-153.

`ciTest_table`, `ciTest`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```library(gRim) data(dumping, package="gRbase") ciTest_ordinal(dumping, c(2,1,3), stat="jt", N=1000) ciTest_ordinal(dumping, c("Operation", "Symptom", "Centre"), stat="jt", N=1000) ciTest_ordinal(dumping, ~Operation + Symptom + Centre, stat="jt", N=1000) data(reinis) ciTest_ordinal(reinis, c(1,3,4:6), N=1000) # If data is a dataframe dd <- as.data.frame(dumping) ncells <- prod(dim(dumping)) ff <- dd\$Freq idx <- unlist(mapply(function(i,n) rep(i,n),1:ncells,ff)) dumpDF <- dd[idx, 1:3] rownames(dumpDF) <- 1:NROW(dumpDF) ciTest_ordinal(dumpDF, c(2,1,3), stat="jt", N=1000) ciTest_ordinal(dumpDF, c("Operation","Symptom","Centre"), stat="jt", N=1000) ciTest_ordinal(dumpDF, ~ Operation + Symptom + Centre, stat="jt", N=1000) ```