Error bars on two way line plot
8 次查看(过去 30 天)
显示 更早的评论
Gul Niamat Shah
2019-5-18
i want do draw error bars on each data point. how to find the size/length of error bar??Anyone there who can guide me? I don't have the idea, either it will of specific size e.g plus minus 4 etc or it will be calculated from set of data points and then to be placed on plot.

22 个评论
Adam Danz
2019-5-18
" How to find the size/length of error bar?"
There is no single entity called "error". You have to define it. Error could be the difference between predictions and measured data (aka residuals). Error could be the width of a distribution created by bootstrapping (eg: confidence intervals). Error could merely be the standard deviation of a distribution.
Do you have repeated measures of your data points?
Gul Niamat Shah
2019-5-18
编辑:Gul Niamat Shah
2019-5-18
Sir actually I have three columns. In first column it is angle 45,90 and 135 and 2nd and 3rd columns contain values of forces for dry and wet particles. I've plotted forces values against different angels. 2 line plot is obtained as shown above. Now I Wana to check the reliability of data by using error bars. How I can do this?? What procedure should be followed? How the error bar value can be calculated. Kindly guide me as I am new to this. Thanks Adam danz
Gul Niamat Shah
2019-5-18
编辑:Gul Niamat Shah
2019-5-18
Speed (30,60,90), MGMMI(dry) [0.9837,0.925,0.9814],MGMMI(wet)[0.9531,0.9126,0.9357] Consider this case. Again plotting MGMMIs values against speed values(speed on x_axis and MGMMI, dry and MGMMI, wet on y _axis) will result two way line plot as we obtain in aforementioned case. Suppose if I want to calculate error bars for this case, how I will proceed?? Numerical values are now given, it would be better if you guide me with some calculations.. Thanks Adam danz
Adam Danz
2019-5-18
编辑:Adam Danz
2019-5-18
I'll try to give an example of the problem.
Let's say I have a measurement of a = 9. What is the error of that?
You can't answer that question because I haven't defined what "error" is.
If you have repeated measures, one definition of error is +/- the standard deviation of the mean. For example, if my measurments are a = [7 6 8 9 10 12 11], the mean is 9 and the std is 2.16. Now I can create error bars that are +/- 2.16 from 9.
Alternatively I could define error as "standard error" which is 2 for those measurments. So the errorbars would extend +/-2 from the mean.
Let's say I took 1 measurement with a device that is known to have an error of +/- 3. Now I can make error bars that are +/-3 from my measurement.
So, before you get into ploting error bars, you need to know what the error is and we can't help you with that unless you give us more information.
[ADDENDUM]
I saw your photo after writing this comment. But I don't know what I'm looking at here.
Adam Danz
2019-5-18
编辑:Adam Danz
2019-5-18
I understand your updated comment above completely (except I don't know what MGMMI is but that probably doesn't matter). I'm aware that you used those values to create those lines.
What I'm trying to communicate is that 1) you haven't defined what "error" is and 2) there's not enough data to caluculate any kind of error for each point in the plot.
Gul Niamat Shah
2019-5-18
编辑:Gul Niamat Shah
2019-5-18
Sir many Thanks for your quick response... What I learned from your comments is that first I should define error type. So let its is std ( by std I think you mean standard deviation, am I correct? ). So as per my understanding now I need to calculate the mean for MGMMI(dry) and mean for MGMMI(wet), from this I will calculate std for each and that these calculated stds will be my error bar. Definitely these two error bars will be of different sizes. Sir kindly correct me if I am doing some mistake
dpb
2019-5-18
"... one definition of error is +/- the standard deviation of the mean. For example, if my measur[e]ments are a = [7 6 8 9 10 12 11], the mean is 9 and the std is 2.16."
Pedant alert: :)
The std deviation of a is std(a) --> 2.16
The standard deviation of the mean of a is std(a)/sqrt(numel(a)) or
>> std([7 6 8 9 10 12 11])/sqrt(7)
ans =
0.8165
>>
Gul Niamat Shah
2019-5-19
Thanks dpb for response, but little confused ? what is the difference between std deviation of a i. e. Std(a) which in your case is 2.16 and the standard deviation of the mean of a which in your case is 0.8165?? Secondly, for your case, which parameter would now be your error bars either 2.16 or 0.8165?? Waiting for your your kind response
Adam Danz
2019-5-19
Oh gosh, thanks for the correction, dpb! I looked back at my history to figure out my mistake. I was actually calculating standard deviation (instead of standard error) except I divided by n instead of n-1. Thtat's two mistakes!
a = [7 6 8 9 10 12 11];
sqrt(sum((a-mean(a)).^2)/length(a)) % = 2
That's what I get for not simply using std().
Adam Danz
2019-5-19
Gul Niamat Shah, the 2.16 and 0.8165 are just examples calculated from my fake data "a". I was trying to show you two definitions of error and how they are calculated. I was also trying to show you why you haven't shared enough data to calculated either of them.
How was your data collected? Are those points on your graph just single observations or are they the mean of many observations? Does the instrument you're using specify its error?
I feel like you're not grasping what error is or maybe I'm not understanding your query.
Perhaps reading or watching some tutorials online would be helpful in understanding how error is calculated and represented.
Gul Niamat Shah
2019-5-20
编辑:Gul Niamat Shah
2019-5-20
Sir these points are the result of single observations. I have taken single measurements for each point. Data was calculated in LIGGGTs open source software. My system (vertical cylindrical four bladed mixer) actually consist of 10 thousand particles, goal was to determine velocities and forces against time nd speed of mixer. So I calculated mean velocity and mean force at specific speed of mixer, again from mean value I mean that it the average/mean velocity/force of all the particles, here mean value doesn't mean that it is the mean of many observations at that particular speed rather it is single measured average value of all particles at that particular speed. So I think now it is clear that these values are single measured values
Adam Danz
2019-5-20
编辑:Adam Danz
2019-5-20
You can't calculate error from a single observation. For example, If I weigh myself once and I weight 85kg, how much error is there? Impossble to answer (unless the scale has a known error but even then, that only accounts for one source of error). However, if I weight myself 10 times on the same scale and record weighs of [84.8, 86.0, 85.2, ....], now I can calculate standard error (or other types of error).
I noticed that your y axis label is "total mean force". That tells me that you do have repleated measurements - how else would you calculated the mean? Do you have the data that was used to compute the means?
Adam Danz
2019-5-20
编辑:Adam Danz
2019-5-20
(Replying to your updated comment)
"So I calculated mean velocity and mean force at specific speed of mixer"
Could you share the relevant code where you calculated that? It probably looks something like this: mean(v) where v is a vector of force measurements for a given speed. Maybe it's a matrix.
"here mean value doesn't mean that it is the mean of many observations at that particular speed rather it is single measured average value of all particles at that particular speed"
You lost me. A mean is not measured; ever. A mean is calculated. "Measured" means you used an instrument such as a force meter, a ruler, a scale, a voltage meter, etc to measure something. The phrase " single measured average value " is nonsensical. It sounds like you measured the force of many particles at several different speeds. If that's the case, then I interpret each point in your plot as the average force across all particles for a single speed. Is that correct?
"So I think now it is clear that these values are single measured values"
Definitely still not clear but we're making progress.
dpb
2019-5-20
If so, the model is deterministic from what I see and there is no "error" per se -- every calculation of the same system will be the same value and your "mean" measurements are averages over the number of particles you simulated for the problem.
If this is the correct interpretation of your data, the only way to know what "error" there is in the simulation model relative to an actual physical measurement of the modelled system would be to have comparative data that shows how well the system does model similar systems; you can't determine that from the results of the simulation alone.
Gul Niamat Shah
2019-5-25
Thanks dpt and Adam Danz... now you got my point. Exactly i used liggghts-open-source-discrete-element-method-particle-simulation-code. This actually calculate mean value of parameters (velocity, force etc.) for all particles at particular time step. This actually result a single mean value at each time step. And as by definition of error it is not possible to calculate error from this single mean value. But I am confused if this is true then why my reviewer asked me to draw error bars at each point??? My Reviewer comments is given as:
“The error bars must be included by taking 3-5 sets data at steady state and obtaining the mean value for a reasonable time period. All the results then need to include the error bars so that the results could be taken seriously. This is one of the major drawbacks of the work.”
How can I defend my point in front of him? What should be my reply so that I could satisfy him?? waiting for your response ......
dpb
2019-5-25
编辑:dpb
2019-5-25
That's not a ML question at all; but one to resolve with the reviewer who possibly doesn't understand the issue him/herself...or, possibly it hinges on what would be the meaning in the review comments of the "3-5 sets data" in what would be other datasets that would produce different answers? Or, it's quite possible in my VERY brief look at the model description I missed the fact that it is a probabilistic model and there would be a non-deterministic solution so that re-running the case does produce a somewhat different answer.
We haven't enough information to know which of those (or others) might be the correct answer...you'll just have to research to ensure you understand the modelling process well enough to know whether there is a way to produce what the reviewer is asking for or not...and explain that and find out whether the request is feasible or not.
ADDENDUM:
Oh...random thought--is there an initial distribution function for the starting point of the simulation that would make sense to vary that could lead to slightly different steady-state vlue estimates? Or some other reasonable (set of) parameter(s) that are not necessarily deterministic at the onset?
Adam Danz
2019-5-28
编辑:Adam Danz
2019-5-28
Here are my three thoughts (worth 6 cents). If the model is deterministic and therefore always produces the same results given the same inputs, perhaps the inputs could be "jittered" (slightly, randomly changed) similar to approaches used in curve fitting. If you'd jitter the inputs 200 times you'd get 200 "means" that you could use to calculate error bars. I have no idea if this approach (again, analogous to curve fitting) would be appropriate for your simulations.
My second and preferred idea is that if the simulations are producing a mean, there's got to be a distribution somewhere in the code from which the mean is being calculated. It may not be an output, but it's in there somewhere. It's gotta be there. You could use that distribution to calculate the errorbars.
Lastly, as dpb mentioned, perhaps the reviewer doesn't understand why errorbars are not possible with the simulation. If you are 110% sure that errorbars are not appropriate for the data, simply telling the reviewer that may not be satisfactory. The reviewer is probably right to indicate that some indication of error is necessary "so that the results could be taken seriously". Currently there's nothing in your data that suggest that dry and wet conditions actually differ. The error could look like this for all we know:

dpb
2019-5-28
"My second and preferred idea is that if the simulations are producing a mean, there's got to be a distribution somewhere in the code from which the mean is being calculated."
The problem here is that it isn't a distribution in the sense of a pdf; instead there's a geometric distribution of the simulated particles and it's the mean location of those that is being reported. What the dispersion of those is is not related to the error in the calculation relative to "truth".
Your "jitter" solution is essentially my last thought as well and, with what little we know, probably the best that could be done without being able to actually perform the experiments on physical samples rather than the computations alone.
dpb
2019-5-28
Yes, there are many subject areas on Answers I have no idea of, either; and all I know of this is a 90 second perusal of the description of the modeling package OP is using that did at least explain what was being averaged.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
