Need help with Beta and Gamma distribution (MATLAB)

Majix

New member
Joined
Oct 20, 2020
Messages
1
Hello. I need help with understanding matlab algorithm with beta and gamma distribution.
1) Algorithm with Beta distibution (MATLAB):

function [expected, phat]=bayes_beta_beta(prior_proportions,successes,trials)
phat=betafit(prior_proportions);
alpha = phat(1);
beta = phat(2);
expected=(successes+alpha)./(trials+beta+alpha);
end

My question - how did we get expected value this way? In Wikipedia expected value of Beta distribution - alpha/(alpha+beta).
2) Algorithm with Gamma distibution (MATLAB):

function [expected, phat]=bayes_gamma_expo(prior_data,sample,valid_n)
phat=gamfit(prior_data);
alpha = phat(1);
beta = phat(2);
expected=1./((alpha+valid_n)./(1/beta+sample));
end

My question is same - how did we get this strange formula for expected values? Sorry if my questions is silly. I'll be glad to any materials or tips about my questions.
 
Hello. I need help with understanding matlab algorithm with beta and gamma distribution.
1) Algorithm with Beta distibution (MATLAB):

function [expected, phat]=bayes_beta_beta(prior_proportions,successes,trials)
phat=betafit(prior_proportions);
alpha = phat(1);
beta = phat(2);
expected=(successes+alpha)./(trials+beta+alpha);
end

My question - how did we get expected value this way? In Wikipedia expected value of Beta distribution - alpha/(alpha+beta).
2) Algorithm with Gamma distibution (MATLAB):

function [expected, phat]=bayes_gamma_expo(prior_data,sample,valid_n)
phat=gamfit(prior_data);
alpha = phat(1);
beta = phat(2);
expected=1./((alpha+valid_n)./(1/beta+sample));
end

My question is same - how did we get this strange formula for expected values? Sorry if my questions is silly. I'll be glad to any materials or tips about my questions.
Please show us what you have tried and exactly where you are stuck.

Please follow the rules of posting in this forum, as enunciated at:


Please share your work/thoughts about this problem.
 
Top