m_10000 perm.vector_c() y_rgamma(10,10) x_rgamma(10,5) d1_mean(y)-mean(x) for(i in 1:m) { combo_c(x,y) perm_sample(combo, replace=T) x.new_c(perm[1:10]) y.new_c(perm[11:20]) diff.mean_mean(y.new)-mean(x.new) perm.vector_c(perm.vector,diff.mean) } hist(y) hist(x) hist(perm.vector,col=5) summary(x) summary(y) print(d1) sig.level_length(perm.vector [perm.vector > d1])/m print(sig.level)