wilcoxon_signed_rank_interval = function( data, c, debugging=FALSE ){ # # Returns: # # See Page 616 from the book Probability and Statistics: For Engineering and the Sciences by Jay L. Devore # # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- data_outer = outer( data, data, FUN="+" ) inds = upper.tri( data_outer, diag=TRUE ) data_outer = as.vector( data_outer[inds] )/2 data_outer_sorted = sort( as.vector(data_outer) ) if( debugging ){ print( data_outer_sorted ) } n = length(data) # Find the two ranks of the lower and upper limits: ll_index = as.integer( n*(n+1)/2 - c + 1 ) ul_index = as.integer( c ) if( debugging ){ print( c(ll_index,ul_index) ) } list( ll=data_outer_sorted[ll_index], ul=data_outer_sorted[ul_index] ) }