Calculate Standard deviation from pdf

8 ビュー (過去 30 日間)
zorra2578
zorra2578 2014 年 7 月 18 日
コメント済み: Xiao Yang 2020 年 4 月 11 日
Hello,
I'm new to Matlab and trying to use it to estimate standard deviation of distribution from pdf of a distribution. I have random values and probability for these value like to following:
Values (Prob) 10 (0.1) 11 (0.2) 12 (0.4) 13 (0.05) 14 (0.05) 15 (0.2)
Is there any function/code to estimate the standard distribution? Thanks.

採用された回答

Star Strider
Star Strider 2014 年 7 月 18 日
These are termed a weighted mean and standard deviation:
% % % References:
% % % https://en.wikipedia.org/wiki/Weighted_standard_deviation#Weighted_sample_variance
% % % http://itl.nist.gov/div898/software/dataplot/refman2/ch2/weightsd.pdf
%
% 10 (0.1) 11 (0.2) 12 (0.4) 13 (0.05) 14 (0.05) 15 (0.2)
X = 10:15; % Data
W = [0.1 0.2 0.4 0.05 0.05 0.2]; % Weights
N = length(X);
Wmean = X*W'/sum(W); % Weighted mean
Wstd = sqrt((sum(W.*(X - Wmean).^2)/N) / ((N-1)*sum(W)/N)); % Weighted std
  3 件のコメント
Star Strider
Star Strider 2014 年 7 月 18 日
My pleasure!
Xiao Yang
Xiao Yang 2020 年 4 月 11 日
I don't think the first "/N" should be there in the calculation of Wstd

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProbability Density Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by