
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Plotting Normal Dirstribution/ bell curve
Hi
I am trying to plot a Normal Distribution curve over the following barchart of sales increase.
Sales increase is a decimal representing the % increase.
I have tried a number of expressions but I'm having no luck,
I've tried using the NORMDIST function which I've played around but it isnt working, as well as creating an expression from scratch.
normdist(salesInc,avg(salesInc),stdev(salesInc))
for the graph I use the
dimension class(salesInc,5)
expression count(salesInc)
I'd be greatfull if you could point me in the right direction or show me some qlikview examples of normaldistribution,
- « Previous Replies
-
- 1
- 2
- Next Replies »


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RIGHT CLIC PROPERTIES SORT, Y-VALUES DESCENDING.
HOPE IT HELPS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Facundo,
I think the problem is more to do with my expressions for the normal distribution curve,as the Y axis and bar graph is how I would like it.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you add a qwv.?? to see real what happend?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The normdist() function is cumulative, so I think you'll need to do something like this:
normdist(salesInc,avg(salesInc),stdev(salesInc))
-normdist(above(salesInc),avg(salesInc),stdev(salesInc))
I probably have something wrong there, but it's hard to know without a QVW to play with.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks John
I've played around with it and so far this formula seems to be producing a line on my graph i just need to see if its the right line.
I think my problem was with the class(salesInc, 10) function,I moved it from being a calculated dimension to being part of the expresssion
normdist( CLASS(salesInc, 10) ,avg({1} total CLASS(salesInc, 10)),stdev({1} total CLASS(salesInc, 10)))
-normdist(above(CLASS(salesIncc, 10)),avg({1} total CLASS(salesInc, 10)),stdev({1} total CLASS(salesInc, 10)))) / (CLASS(salesInc,10)-above(CLASS(salesInc, 10))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found an example on my hard drive of calculating a normal distribution curve from points.
600*(normdist( AHT ,avg({1} total AHT),stdev({1} total AHT))
-normdist(above(AHT),avg({1} total AHT),stdev({1} total AHT)))
/(AHT-above(AHT))
On brief glance, it looks like what you're doing other than the 600 part and your use of class(). So I suspect you have it working right. As a possible simplification, rather than use class() in the expression or dimension, you could create a salesIncClass field in the script.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is in fact a fourth argument you can use with the normdist() function (it's not in the HELP, but in the editor tooltip), where you can switch between cumulative and non cumulative mode, so
normdist( CLASS(salesInc, 10) ,avg({1} total CLASS(salesInc, 10)),stdev({1} totalCLASS(salesInc, 10)),0 )
should be enough.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I the formula above works to show the curve but does not work when the variables are grouped together, I have tried to group them together in the load script but it doesnt work as the x axis needs to be a number.
At the moment the x-axis is continuous numbers so the bars are counded for each individual number rather than a group.
Can anyone help me group the x axis?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when I view my chart in table format these are the values that I have for some reason there is an error calculating the values around he mean
Frequency | Normal Frequency | Normal Frequency | |
-20 <= x < -15 | 1 | 0.000338372 | - |
-15 <= x < -10 | 1 | 0.009322085 | 0.028161867 |
-10 <= x < -5 | 6 | - | - |
-5 <= x < 0 | 28 | - | - |
0 <= x < 5 | 86 | - | - |
5 <= x < 10 | 29 | - | - |
10 <= x < 15 | 5 | - | - |
15 <= x < 20 | 3 | - | - |
20 <= x < 25 | 1 | 0.002968246 | - |
25 <= x < 30 | 1 | 0.000227747 | 0.007159788 |
30 <= x < 35 | 1 | 1.6E-5 | 0.000422699 |
40 <= x < 45 | 1 | 1.5E-9 | 2.7E-5 |
45 <= x < 50 | 1 | 1.4E-10 | 1.6E-9 |
- | 20 | - | - |
The first Column is the dimension - class(salesInc,5)
2nd colomn expression - expression count(distinct salesId)
3rd column -normdist( salesInc,avg({1} total salesInc),stdev({1} total salesInc),0 )
4th comumn - (normdist( salesInc ,avg({1} total salesInc),stdev({1} total salesInc))
-normdist(above(salesInc),avg({1} total salesInc),stdev({1} total salesInc)))
* Count(DISTINCT
salesId))
- « Previous Replies
-
- 1
- 2
- Next Replies »