How do I calculate the error of my data?

Var(x_1+x_2+...+x_n)So the standard deviation of the sum of variables is the square root of the sum of the variances, if they are independent.In summary, the conversation discusses the process of calculating the total mass and error in an experiment with multiple repetitions. The data consists of mass flow rates vs. time and the trapetzoid rule is used to calculate the area. The standard deviation is also calculated and the error is determined by adding the variances in quadrature. The process is repeated for each chemical and the total error is calculated by adding the individual variances together. The conversation also mentions the importance of considering the independence of measurements in calculating the error.
  • #1
tjosan
33
2
Hello.I have 3 repitions of an experiment. The data consists of mass flow rates vs. time.
What I want to do is to calculate the mass vs. time, i.e. integrating my data.

I consider the resolution for each measurement to be exactly 3 minutes. To calculate the area I use the trapetzoid
rule, i.e. [itex](y(i)+y(i+1))/2*\Delta X= (y(i)+y(i+1))/2*3[/itex]

Now I want calculate the error. I know using the trapetzoid rule introduce errors, but since I
have no way of knowing how this affects my result I don't care about that particular error. Rather I want to know
the error between my 3 repititions.
My data look like this:
X # 1 # 2 # 3
0 y11 y21 y31
3 y12 y22 y32
6 y13 y23 y33
. . . .
. . . .
. . . .
n y1n y2n y3n
where y is mass flow rates and x is time.

This is my approach:
Calculate the mean mass flow rate, i.e
[itex]yavg(1)=(y11+y21+y31)/3[/itex]
[itex]yavg(2)=(y12+y22+y32)/3[/itex]
[itex]yavg(3)=(y13+y23+y33)/3[/itex]
...
[itex]yavg(n)=(y1n+y2n+y3n)/3[/itex]

and also the standard deviation

[itex]ystd(1)=std(y11,y21,y31)[/itex]
[itex]ystd(2)=std(y11,y21,y31)[/itex]
[itex]ystd(3)=std(y11,y21,y31)[/itex]
...
[itex]ystd(n)=std(y11,y21,y31)[/itex]

Then use the trapetzoid rule:
[itex]Area(1)=(yavg(1)+yavg(2))/2*3[/itex]
[itex]Area(2)=(yavg(2)+yavg(3))/2*3[/itex]
...
[itex]Area(n-1)=(yavg(n-1)+yavg(n))/2*3[/itex]

But how do I calculate the error? This I what I think:
[itex]Error(1)=sqrt((ystd(1)^2+ystd(2)^2)/2*3))[/itex]
[itex]Error(2)=sqrt((ystd(2)^2+ystd(3)^2)/2*3))[/itex]

or should it be like this:
[itex]Error(1)=sqrt(ystd(1)^2+ystd(2)^2)[/itex] ??

[itex]Area(1)+-Error(1)[/itex]
[itex]Area(2)+-Error(2)[/itex]

.. etc

And suppose I want to calculate the total mass, i.e Area(1)+Area(2)...+Area(n-1), then what will the error be?

Thanks
 
Physics news on Phys.org
  • #2
Do you have a good reason to expect the same time dependence of mass flow for all three repetitions?

You have to be careful to account for the uncertainty exactly once: the uncertainty on area 1 and on area 2 are correlated.
Luckily, your trapezoid rule can be simplified: total area is 3 minutes * (1/2 yavg(1) + yavg(2) + yavg(3) + ... + 1/2 yavg(n)). The uncertainties on those averages now can* be independent, and you can add them in quadrature.

*something that would need more investigation: what leads to different measurements between the repetitions?
 
  • #3
Hi, thank you for your answer.

I am using an instrument (gas chromatograph) to measure concentrations for different chemicals which I then relate to their mass. The chemicals are produced in the same way for all three experiments so I expect the result to be "the same".

Since I am multiplicating and dividing my areas with constants, should I do the same to the uncertainties also? I.e std=sqrt(3*(var_1*0.5+var_2+...+var_n*0.5)), where var is the variance.

Random error would be the reason for having different values, although I suspect sample inhomogeneity probably has a larger impact. If this is the case I guess the standard deviation is more a measurement of how good I sample rather than the uncertainty of the measurements :) But I assume that I only have random errors since I normalize my results.
 
  • #4
tjosan said:
Since I am multiplicating and dividing my areas with constants, should I do the same to the uncertainties also?
Sure. But do it outside the square root. Standard deviations scale linearly if you just multiply the uncertain value with some constant, variances scale with the square of that value. This also means your *0.5 should be *0.25.
tjosan said:
If this is the case I guess the standard deviation is more a measurement of how good I sample rather than the uncertainty of the measurements :)
That is a possible issue.
tjosan said:
But I assume that I only have random errors since I normalize my results.
Normalize to what? That could be relevant as well.
 
  • #5
mfb said:
Normalize to what? That could be relevant as well.
Actually I realized that the data is not normalized, nevermind what I wrote.

mfb said:
Sure. But do it outside the square root. Standard deviations scale linearly if you just multiply the uncertain value with some constant, variances scale with the square of that value. This also means your *0.5 should be *0.25.
Thank you.

So if I understand you correctly, I should calculate the error like this:

## 3^2*(s1^2*0.25^2+s2^2...+sn^2*0.25^2)=total variance##

One more question.

The instrument detect several chemicals. So in addition to calculating the mass for each chemical, I also need to add those masses together to get the total mass. I assume that I just repeat the process for each chemical, and in the end, I add all the variances and square root them to get the total standard deviation.

E.g.

Chemical A:
Average mass of ##A = 3*(A_1*0.5+A_2+...+A_n*0.5)##
Variance of ##A = 3^2*(S_{A1}^2*0.5^2+S_{A2}^2+...+S_{An}^2*0.5^2)##

Chemical B:
Average mass of ##B = 3*(B_1*0.5+B_2+...+B_n*0.5)##
Variance of ##B = 3^2*(S_{B1}^2*0.5^2+S_{B2}^2+...+S_{Bn}^2*0.5^2)##
.
.
.
Chemical K:
Average mass of ##K = 3*(K_1*0.5+K_2+...+K_n*0.5)##
Variance of ##K = 3^2*(S_{K1}^2*0.5^2+S_{K2}^2+...+S_{Kn}^2*0.5^2)##Total mass:
##{\text{Average mass of A}}+{\text{Average mass of B}}+...+{\text{Average mass of K}}##
Total error:
##sqrt({\text{Variance of A}}+{\text{Variance of B}}+...+{\text{Variance of K}})##
 
  • #6
tjosan said:
So if I understand you correctly, I should calculate the error like this:

## 3^2*(s1^2*0.25^2+s2^2...+sn^2*0.25^2)=total variance##
Right.
The instrument detect several chemicals. So in addition to calculating the mass for each chemical, I also need to add those masses together to get the total mass. I assume that I just repeat the process for each chemical, and in the end, I add all the variances and square root them to get the total standard deviation.
If all those measurements are independent, that works.
 
  • #7
Watch that your variance now is the same as it would be by error propagation (no correlation between your [itex]x_i[/itex]):
You have the variable [itex]f(x_1,x_2,...,x_n) = a (bx_1 + x_2 + ... + bx_n)[/itex]
and its deviation will be [itex]\sigma_f = \sqrt{\Big(\frac{\partial f}{\partial x_1} \sigma_{x1}\Big)^2+ \Big(\frac{\partial f}{\partial x_2 } \sigma_{x2} \Big)^2 + ... + \Big(\frac{\partial f}{\partial x_n} \sigma_{xn} \Big)^2}[/itex]
or [itex] \sigma_f^2 \equiv Var(f) = a^2 b^2 Var(x_1) + a^2 Var(x_2) + ... +a^2 b^2 Var(x_n) = a^2 \big( b^2 Var(x_1) + Var(x_2) +... + b^2 Var(x_n) \big) [/itex]
 

Related to How do I calculate the error of my data?

1. What is the definition of error in data calculations?

Error in data calculations refers to the difference between the true value and the measured or calculated value. It is a measure of how accurate the data is and can be expressed as a percentage or absolute value.

2. How do I calculate the error of my data?

To calculate the error of your data, you need to first determine the true value, which can be obtained through a reference source or by taking multiple measurements and finding the average. Then, subtract this true value from the measured or calculated value and divide by the true value. Finally, multiply by 100 to get the error as a percentage.

3. What is a common method for representing error in data calculations?

A common method for representing error in data calculations is through the use of error bars on graphs or charts. These bars can show the range of error for each data point and provide a visual representation of the overall accuracy of the data.

4. How can I reduce the error in my data calculations?

To reduce the error in your data calculations, you can take multiple measurements and calculate the average, which can help to minimize any random errors. You can also improve the precision of your measuring instruments and techniques, as well as carefully selecting a suitable method for data analysis.

5. Is it possible to have 0% error in data calculations?

In theory, it is possible to have 0% error in data calculations. However, in practice, there will always be some degree of error due to limitations in measuring instruments and techniques. It is important to aim for the lowest possible error, but complete elimination of error is not always achievable.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
915
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
718
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
37
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
56
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
24
Views
2K
Back
Top