Scale beta distribution in a given interval

조회 수: 11 (최근 30일)
Cladio Andrea
Cladio Andrea 2015년 2월 21일
답변: Rajesh Chandrasekaran 2022년 8월 19일
Hello everyone, i have a beta distribution
X = 0:.01:1;
y1 = betapdf(X,3,4);
figure
plot(X,y1,'Color','r','LineWidth',2)
but as you know it is in betwneen [0,1] second , but i want to rescale it, i want to change interval lets say to [0,60]. Can you help me please?

채택된 답변

Greig
Greig 2015년 2월 22일
For a standard Beta distribution, our random variate x, exists in the range 0 to 1.
First we start with a transformed variable, y = X(q - p) + p, which exists from p to q. If we let and b, represent the shape parameters (alpha and beta) of a Beta distribution and B(a,b) is the beta function
PDF = ( (y-p)^(a-1) * (q - y)^(b-1) ) / ( (q - p)^(a+b+1) * B(a,b) )
So here is a quick function that should do the trick...
function PDF = Scaled_BetaPDF(y, a, b, p, q)
PDF = ( (y-p).^(a-1) .* (q - y).^(b-1) ) ./ ( (q - p).^(a+b-1) .* beta(a,b) );
So try
X = 0:.01:60;
y1 = betapdf(X,3,4);
y2=Scaled_BetaPDF(X, 3, 4, 0, 60);
and compare.
  댓글 수: 1
Cladio Andrea
Cladio Andrea 2015년 2월 22일
Thank you so much that is exactly what i need!!!

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

추가 답변 (1개)

Rajesh Chandrasekaran
Rajesh Chandrasekaran 2022년 8월 19일
Please check the above solution:
It should be
PDF = ( (y-p)^(a-1) * (q - y)^(b-1) ) / ( (q - p)^(a+b-2) * B(a,b) )

Community Treasure Hunt

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

Start Hunting!

Translated by