Learn R Programming

NSM3 (version 1.1)

pJCK: Function to compute the P-value for the observed Jonckheere-Terpstra J statistic.

Description

This function computes the observed J statistic for the given data and corresponding P-value. When there are no ties in the data, the function takes advantage of Harding's (1984) algorithm to quickly generate the exact distribution of J.

Usage

pJCK(x,g=NA,method=NA, n.mc=10000)

Arguments

Value

Returns a list with "NSM3Ch6p" class containing the following components:na vector containing the number of observations in each of the data groupsobs.statthe observed J statisticp.valupper tail P-value

Details

The data entry is intended to be flexible, so that the groups of data can be entered in either of two ways. For data a=1,2 and b=3,4,5 the following are equivalent: pJCK(x=list(c(1,2),c(3,4,5))) pJCK(x=c(1,2,3,4,5),g=c(1,1,2,2,2))

References

Harding, E. F. "An efficient, minimal-storage procedure for calculating the Mann-Whitney U, generalized U and similar distributions." Applied statistics (1984): 1-6.

Examples

Run this code
##Hollander-Wolfe-Chicken Example 6.2 Motivational Effect of Knowledge of Performance
motivational.effect<-list(no.Info=c(40,35,38,43,44,41),rough.Info=c(38,40,47,44,40,42),
                          accurate.Info=c(48,40,45,43,46,44))
#pJCK(motivational.effect,method="Monte Carlo")
pJCK(motivational.effect,method="Asymptotic")

Run the code above in your browser using DataLab