Skip to content

Instantly share code, notes, and snippets.

@mrkrause
Created September 23, 2014 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkrause/2b315222abd00c902a1d to your computer and use it in GitHub Desktop.
Save mrkrause/2b315222abd00c902a1d to your computer and use it in GitHub Desktop.
NREP = 30000;
N = 1000;
K = 5;
p_random = nan(NREP, 1);
p_cluster = nan(NREP, 1);
parfor rep=1:NREP
data = randn(N, 1);
random_group = mod(randperm(N), K);
cluster_group = kmeans(data, K);
p_random(rep) = anova1(data, random_group, 'off');
p_cluster(rep) = anova1(data, cluster_group, 'off');
end
sp = 0.025:0.05:1;
subplot(1,2,1);
hist(p_random, sp);
axis('tight');
subplot(1,2,2);
hist(p_cluster, sp);
axis('tight');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment