Standard deviation of values with standard deviation
3 次查看(过去 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!