Generate all possible group scores based on combinations of individuals

I want to compare actual group scores to hypothetical scores cosnidering all possible combinations of individuals.
I'd like to plot out the actual group scores to that of all possible combinations (i.e., Actual scores for groups vs possible scores of nCr groups) for each item.
Is there a function to generate possible groupings and plot their scores?
Thank you!

댓글 수: 5

Do I understand correctly that you want to consider all possible ways of forming 20 groups of size 3 that can be formed out of 60 individuals? There are something like 10^66 different ways of doing that, which seems like an impractically and unnecessarily large number to look at.
HI Jeff,
I'm getting 'only' factorial(60)/factorial(20)/factorial(3)^20 = 9.3546e+47 which still seems to be a challenge for my hard drive.
Hi David,
I was thinking that the group ID mattered, so I computed:
log10sum = 0;
totalN = 60;
for iGroup = 1:20
nChoices = nchoosek(totalN - (iGroup-1)*3,3);
log10sum = log10sum + log10(nChoices);
end
log10sum
log10sum =
66.357
But maybe that's wrong and the OP doesn't want to distinguish between (say) [group 1 = {1,2,3} & group 2 = {4,5,6}] versus [group 1 = {4,5,6} & group 2 = {1,2,3}], in which case my count is too high.
Hi Jeff,
good point, I had not considered group ID so either you would or would not have a factor of factorial(20).
Jeff, yes I want to consider all possible ways of forming 20 groups of size 3 that can be formed out of 60 individuals. I don’t need to see the group IDs, I am mainly interested in comparing the plots for my actual groups’ data to that of what could have been formed

댓글을 달려면 로그인하십시오.

 채택된 답변

Morgan, my point was that "all possible ways" is just too many in this case. By my calculations, if your computer could process one million different group assignments per second, it would still take about 3*(10^52) years to process all of the possible combinations.
A more practical approach is to generate many random group assignments and compare the plots for your actual data again what would happen with random divisions into groups. The code might look something like this:
nIterations = 100; % Increase to a very large number.
GroupAssignment = repmat(1:20,1,3); % 3 members in each of 20 groups.
for iIter=1:nIterations
RandomAssignment = randperm(60);
currentGroup = GroupAssignment(RandomAssignment);
% Now currentGroup(j) is the random group assignment of score j, j=1..60
% Do whatever computation you want for this random assignment of scores to groups,
% and save the result of that computation so that you can see what happens
% over many random groups.
end
% Now tabulate the results across all the random group assignments.
% You haven't looked at all of the possible ones, but if nIterations is
% large then you have probably looked at enough to get a good idea of what
% might happen by chance with other group assignments.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 6월 14일

편집:

2022년 6월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by