|
Histogram Chart with Bell curve |
Posted by Dams on May-13-2012 23:51 |
|
Great FrameWork! I want one clear explaination example on Histogram with bell curve Chart using Java. Actually, x-axis labels are hours like {"24+","12-24","0-12","0-12","12-24","24-36","36-48","48-60","60-72","72+"} and y-axis values are {210,130,89,0,0,0,0,0,0,2}. How can I draw the bell curve chart using my data.Is there any need to calculate mean, standard deviation and norml distributions. can you please provide the normal distribution formula.
I need your help. |
Re: Histogram Chart with Bell curve |
Posted by Peter Kwan on May-15-2012 04:14 |
|
Hi Dams,
To draw a bell curve, you just need to know the mean and standard deviation. Then you can use it to compute 7 to 9 data points, and join them using a spline line layer. Because there are only a few points, you do not need to formula for the normal distribution. Instead, you can just hard coded the z-value of the normal distribution for these 7 or 9 points (just like how you look up the value using a normal distribution table). If for some reasons, you would need to normal distribution formula, please refer to http://en.wikipedia.org/wiki/Normal_distribution
There is a very simple example in the following thread:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1257515780
Note that it is not possible to compute the mean or standard deviation from grouped data. For example, suppose you have one group called "24+", and there is just 3 count, and all other groups are 0, what is the mean? It is impossible to know (unless you made some assumption that "24+" is considered to be exactly equal to "30", but ChartDirector does not know what assumption you can made). To compute the mean, you should have the individual data points, not the "grouped data".
If you have the individual data points, you may use the ChartDirector ArrayMath utility to compute the mean and stardard deviation. For example:
double mean = new ArrayMath(myData).avg();
double stddev = new ArrayMath(myData).stdDev();
Hope this can help.
Regards
Peter Kwan |
Re: Histogram Chart with Bell curve |
Posted by Dams on May-15-2012 16:01 |
|
Hi Peter,
Thanks for your reply. I have attached the image file. Can you let me know if this is a valid scenario to draw the bell curve in Histogram
Thanks
Dams |
Re: Histogram Chart with Bell curve |
Posted by Dams on May-15-2012 16:10 |
|
I forgot to upload the file.
|
Re: Histogram Chart with Bell curve |
Posted by Peter Kwan on May-16-2012 04:23 |
|
Hi Dams,
A bell curve should be used if you know (by theory or assumption) that the data are distributed according to the normal distribution. In this case, the actual data may not be exactly normally distributed, because of errors in measurements and random sampling. You may estimate the normal distribution using the imperfect data (because you already know it is a normal distribution) by computing the sample mean and variance.
Graphically, you may plot the actual data, and then overlay it with a computed normal distribution. Although the actual data are not an exact normally distribution, it should be close.
For your attached chart, the original curve on the chart is clearly not a bell curve (a bell curve is symmetrical). The data also does not look like normally distributed. However, if you have a theory that your data should be normally distributed, or you think you can assume that they are normally distributed, you can nevertheless plot a bell curve over it. In this case, if your data do not match your assumption or theory, then the curve would not match your data nicely. (Actually, in your attachedl chart, I think the curve does not match the data.)
Regards
Peter Kwan |
|