Learn R Programming

NSM3 (version 1.1)

pKolSmirn: Function to copute the P-value for the observed Kolmogorov-Smirnov J statistic.

Description

This function uses psmirnov2x from the base stats package to compute the J statistic and corresponding P-value. The program is reasonably quick for large data, well after the asymptotic approximation suffices, so Monte Carlo methods are not included. This function primarily serves as a wrapper to the ks.test function with the output standardized to the format of the other functions included in the NSM3 package.

Usage

pKolSmirn(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-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: pKolSmirn(x=c(1,2),y=c(3,4)) pKolSmirn(x=list(c(1,2),c(3,4))) pKolSmirn(x=c(1,2,3,4),g=c(1,1,2,2))

See Also

Also see ks.test().

Examples

Run this code
##Hollander-Wolfe-Chicken Example 5.4 Effect of Feedback on Salivation Rate:
feedback<-c(-0.15, 8.6, 5, 3.71, 4.29, 7.74, 2.48, 3.25, -1.15, 8.38)
no.feedback<-c(2.55, 12.07, 0.46, 0.35, 2.69, -0.94, 1.73, 0.73, -0.35, -0.37)
pKolSmirn(x=feedback,y=no.feedback)

Run the code above in your browser using DataLab