bstrap.tst2 = function(z, y, B, tst) { n = length(z) m = length(y) x = c(z,y) bsamples = matrix(sample(x, size=(n+m)*B, replace=TRUE), nrow=B) tst.star = apply(bsamples, 1, function(x_) (tst(x_[1:n],x_[(n+1):(n+m)])) ) return (tst.star) } tst.meandiff = function(z, y) { mu.z = mean(z) mu.y = mean(y) return ( mu.z - mu.y ) }