Learn R Programming

NSM3 (version 1.1)

pAnsBrad: Function to compute the P-value for the observed Ansari-Bradley C statistic.

Description

When there are no ties in the data, this function uses pansari and cansari from the base stats package to compute the C statistic and P-value ("Exact" or "Asymptotic"). The program is reasonably quick for large data in the absence of ties, well after the asymptotic approximation suffices, so Monte Carlo methods are not included. When there are ties in the data, this function computes the C statistic and P-value ("Exact", "Monte Carlo", or "Asymptotic").

Usage

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

Arguments

Value

Returns a list with "NSM3Ch5p" class containing the following components:mnumber of observations in the first data group (X)nnumber of observations in the second data group (Y)obs.statthe observed C statisticp.valupper tail P-valuetwo.sidedtwo-sided P-value

Details

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

See Also

Also see ansari.test.

Examples

Run this code
##Hollander, Wolfe, Chicken Example 5.1 Serum Iron Determination:
serum<-list(ramsay = c(111, 107, 100, 99, 102, 106, 109, 108, 104, 99, 101, 96, 97, 102, 107,
113, 116, 113, 110, 98),
jung.parekh = c(107, 108, 106, 98, 105, 103, 110, 105, 104, 100, 96, 108, 103, 104, 114, 114,
113, 108, 106, 99))


pAnsBrad(serum)

##or, equivalently:
pAnsBrad(serum$ramsay, serum$jung.parekh)

Run the code above in your browser using DataLab