Calculate the population mean of several probability distributions

15 vues (au cours des 30 derniers jours)
Patrick  WIegel
Patrick WIegel le 21 Oct 2020
Commenté : Patrick WIegel le 22 Oct 2020
Hi all,
I would like to calculate the population average of different proability distirbutions (n=26) with a normal distribution. For each subject, I fitted a single normal probability distribution using the code below (in a loop for each subject). The data are angles from a motor task. I receive 26 different objects with the results including mu, sigma etc (I attached an example from one subject).
Now, I would like to calculate the average proability distribution of these 26 subjects. Does anyone know how to do it? Using the command "mean" does not work. An alternative approach would be to pool the data from all 26 subjects prior to the fitting and only calculate the probaility distribution for this one population file.
Any information is appreciated. Thanks in advance,
Patrick
for i= 1:26
pd_correct(i,:) = fitdist(Change_after_correct{i,:}(:,1),'Normal');
end

Réponses (1)

Stephan
Stephan le 21 Oct 2020
Modifié(e) : Stephan le 21 Oct 2020
Du kannst das direkt in der Schleife machen, in dem Du die benötigten Felder der struct ansprichst und die interessierenden Werte in einem seperaten Vektor speicherst. Mit dem kanst Du dann unkompliziert arbeiten:
% 5x 20 Zufallszahlen als Spielmaterial
A = rand(20,5);
% Preallocation
all_mean_values = zeros(1,5);
for i= 1:5
pd_correct(i,:) = fitdist(A(:,i),'Normal');
% Alle Mittelwerte einsammeln und in Array speichern
all_mean_values(i) = pd_correct(i).mean;
end
% Zeige Vektor der Mittelwerte
disp(all_mean_values)
Das geht natürlich auch im Nachgang mit einer zweiten Schleife, falls die Neuberechnung zu aufwändig ist.
  5 commentaires
Jeff Miller
Jeff Miller le 21 Oct 2020
Just be aware that the notion of an "average probability distribution" is not uniquely defined. For example, instead of averaging the estimated standard deviations (sigma values) you could have averaged the estimated variances (sigma^2 values) and taken the square root of that as the sigma for the average distribution. This would give a (possibly quite) different result and is probably at least as theoretically defensible as averaging sigmas.
Patrick  WIegel
Patrick WIegel le 22 Oct 2020
Yeah, that is a good point.
Using the average of the variances and calculating the SD from that, I receive slightly diferent values. In any case, both ways point towards the same result. Thanks for the input.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by