Skip to content

Instantly share code, notes, and snippets.

@VictorSaenger
Created October 15, 2019 11:51
Show Gist options
  • Select an option

  • Save VictorSaenger/e92c7ab0da66acaded345d7bc3dfdb46 to your computer and use it in GitHub Desktop.

Select an option

Save VictorSaenger/e92c7ab0da66acaded345d7bc3dfdb46 to your computer and use it in GitHub Desktop.
#Copy pooled distribution:
pS = copy.copy(pV)
#Initialize permutation:
pD = []
#Define p (number of permutations):
p=1000
# Permutation loop:
for i in range(0,p):
# Shuffle the data:
random.shuffle(pS)
# Compute permuted absolute difference of your two sampled distributions and store it in pD:
pD.append(np.abs(np.average(pS[0:int(len(pS)/2)]) - np.average(pS[int(len(pS)/2):])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment