Histfit help
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi there, I am trying to plot a PDF of some distributions on my data which are a set of financial daily returns using HISTFIT.
Problem is I want it to be in terms of probability on the y-axis but I get large values like 10-30 (it is just density).
Is there a way I can make this probabilities?
I hope somebody can help.
채택된 답변
Wayne King
2012년 2월 18일
Hi, One way:
% generate 1,000 N(10,2^2) RVs
R = normrnd(10,2,1e3,1);
% get an estimate of mu and sigma from the "data"
[muhat,sigma] = normfit(R);
% construct histogram
[F,X] = hist(R,30);
% get ready to plot as probability histogram
F = F/trapz(X,F);
bar(X,F); hold on;
% use muhat and sigma to construct pdf
x = muhat-3*sigma:0.01:muhat+3*sigma;
% plot PDF over histogram
y = normpdf(x,muhat,sigma);
plot(x,y,'r','linewidth',2);
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!