Standard deviation of values with standard deviation
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
Let's say I have the follwing sample (the error values correspond to the std) :
10 +- 1
15 +- 2
20 +- 3
I want to calculate the average value and the standard deviation. The mean of the [10,15,20] is 15 with std = 4.1 disregarding the individual stds.
How would I calculate the average of the sample and the std taking inti account the individual stds??
Thank you,
Andreas
댓글 수: 0
채택된 답변
the cyclist
2021년 3월 3일
The question you are asking is a specific instance of "propagation of uncertainty". You might want to learn more about the topic.
For this specific case, I believe the answer is
std_sum = sqrt(1^2 + 2^2 + 3^2); % error of sum = square root of (sum of squares of individual uncertainties)
std_mean = std_sum/3
Here is a simulation that suggests that this is correct:
rng default
N = 100000;
x1 = 10 + 1*randn(N,1);
x2 = 15 + 2*randn(N,1);
x3 = 20 + 3*randn(N,1);
x = [x1, x2, x3];
mean_x = mean(x,2);
mean(mean_x)
std(mean_x,1)
figure
subplot(4,1,1), histogram(x(:,1))
xlim([0 30])
subplot(4,1,2), histogram(x(:,2))
xlim([0 30])
subplot(4,1,3), histogram(x(:,3))
xlim([0 30])
subplot(4,1,4), histogram(mean_x)
xlim([0 30])
I would encourage you to be really careful about your terminology. Often when people write x +/- dx, dx refers to the standard error, not the standard deviation. The standard deviation is a property of the parent population. The standard error (of the mean, for example) will depend on the sampling -- specifically on sample size.
I think that what I have written above probably corresponds to what you wanted to know, but be careful.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!