Learn R Programming

gRim (version 0.1.2)

ciTest_ordinal: A function to compute Monte Carlo and asymptotic tests of conditional independence for ordinal and/or nominal variables.

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

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
...
Additional arguments, currently not used

Value

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

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.

References

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

See Also

ciTest_table, ciTest

Examples

Run this code
library(gRim)
data(dumping)
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)

Run the code above in your browser using DataLab