I need to be able to calculate the Six Sigma rating from the PPM. I can use NORMSINV function in Excel but it doesnt seem to work in Access.
=-NORMSINV(PPM/1000000)+1.5 - ' This function is a replacement for the Microsoft Excel Worksheet function NORMSINV.
-
' It uses the algorithm of Peter J. Acklam to compute the inverse normal cumulative
-
' distribution. Refer to http://home.online.no/~pjacklam/notes/invnorm/index.html for
-
' a description of the algorithm.
-
' Adapted to VB by Christian d'Heureuse, http://www.source-code.biz.
-
Public Function NormSInv(ByVal p As Double) As Double
-
Const a1 = -39.6968302866538, a2 = 220.946098424521, a3 = -275.928510446969
-
Const a4 = 138.357751867269, a5 = -30.6647980661472, a6 = 2.50662827745924
-
Const b1 = -54.4760987982241, b2 = 161.585836858041, b3 = -155.698979859887
-
Const b4 = 66.8013118877197, b5 = -13.2806815528857, c1 = -7.78489400243029E-03
-
Const c2 = -0.322396458041136, c3 = -2.40075827716184, c4 = -2.54973253934373
-
Const c5 = 4.37466414146497, c6 = 2.93816398269878, d1 = 7.78469570904146E-03
-
Const d2 = 0.32246712907004, d3 = 2.445134137143, d4 = 3.75440866190742
-
Const p_low = 0.02425, p_high = 1 - p_low
-
Dim q As Double, r As Double
-
If p < 0 Or p > 1 Then
-
Err.Raise vbObjectError, , "NormSInv: Argument out of range."
-
ElseIf p < p_low Then
-
q = Sqr(-2 * Log(p))
-
NormSInv = (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
ElseIf p <= p_high Then
-
q = p - 0.5: r = q * q
-
NormSInv = (((((a1 * r + a2) * r + a3) * r + a4) * r + a5) * r + a6) * q / _
-
(((((b1 * r + b2) * r + b3) * r + b4) * r + b5) * r + 1)
-
Else
-
q = Sqr(-2 * Log(1 - p))
-
NormSInv = -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
End If
-
End Function
Is code that I found at the site listed in the comments of the code. However I can't seem to call this in the query where PPM is calculated. Help!
3 9435
I need to be able to calculate the Six Sigma rating from the PPM. I can use NORMSINV function in Excel but it doesnt seem to work in Access.
=-NORMSINV(PPM/1000000)+1.5 - ' This function is a replacement for the Microsoft Excel Worksheet function NORMSINV.
-
' It uses the algorithm of Peter J. Acklam to compute the inverse normal cumulative
-
' distribution. Refer to http://home.online.no/~pjacklam/notes/invnorm/index.html for
-
' a description of the algorithm.
-
' Adapted to VB by Christian d'Heureuse, http://www.source-code.biz.
-
Public Function NormSInv(ByVal p As Double) As Double
-
Const a1 = -39.6968302866538, a2 = 220.946098424521, a3 = -275.928510446969
-
Const a4 = 138.357751867269, a5 = -30.6647980661472, a6 = 2.50662827745924
-
Const b1 = -54.4760987982241, b2 = 161.585836858041, b3 = -155.698979859887
-
Const b4 = 66.8013118877197, b5 = -13.2806815528857, c1 = -7.78489400243029E-03
-
Const c2 = -0.322396458041136, c3 = -2.40075827716184, c4 = -2.54973253934373
-
Const c5 = 4.37466414146497, c6 = 2.93816398269878, d1 = 7.78469570904146E-03
-
Const d2 = 0.32246712907004, d3 = 2.445134137143, d4 = 3.75440866190742
-
Const p_low = 0.02425, p_high = 1 - p_low
-
Dim q As Double, r As Double
-
If p < 0 Or p > 1 Then
-
Err.Raise vbObjectError, , "NormSInv: Argument out of range."
-
ElseIf p < p_low Then
-
q = Sqr(-2 * Log(p))
-
NormSInv = (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
ElseIf p <= p_high Then
-
q = p - 0.5: r = q * q
-
NormSInv = (((((a1 * r + a2) * r + a3) * r + a4) * r + a5) * r + a6) * q / _
-
(((((b1 * r + b2) * r + b3) * r + b4) * r + b5) * r + 1)
-
Else
-
q = Sqr(-2 * Log(1 - p))
-
NormSInv = -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
End If
-
End Function
Is code that I found at the site listed in the comments of the code. However I can't seem to call this in the query where PPM is calculated. Help!
The following should point you in the right direction:- ASSUMPTIONS
- Table Name: Table1
- Field Name: ID
- Field Name: p_value
- Field Name: Inv_Norm_Cum (this is a Calculated Field which passes the value in the [p_value] as an Argument to the NormSInv Function where it is analyzed and a Return Value generated. The SQL is listed below:
- SELECT Table1.ID, Table1.p_value, NormSInv([p_value]) AS Inv_Norm_Cum
-
FROM Table1;
- The problem lies with a value of p that is outside of the permissible range, namely: < 0 or > 1. With values outside of the range, I simlpy have the Function return a 0, basically to indicate an Error State. It cannot return a Null Value since the return type is defined as Double.
- The modified line of code is listed below (Line #13) - follow this outline and all should be fine. Let me know how you make out.
- Public Function NormSInv(ByVal p As Double) As Double
-
Const a1 = -39.6968302866538, a2 = 220.946098424521, a3 = -275.928510446969
-
Const a4 = 138.357751867269, a5 = -30.6647980661472, a6 = 2.50662827745924
-
Const b1 = -54.4760987982241, b2 = 161.585836858041, b3 = -155.698979859887
-
Const b4 = 66.8013118877197, b5 = -13.2806815528857, c1 = -7.78489400243029E-03
-
Const c2 = -0.322396458041136, c3 = -2.40075827716184, c4 = -2.54973253934373
-
Const c5 = 4.37466414146497, c6 = 2.93816398269878, d1 = 7.78469570904146E-03
-
Const d2 = 0.32246712907004, d3 = 2.445134137143, d4 = 3.75440866190742
-
Const p_low = 0.02425, p_high = 1 - p_low
-
Dim q As Double, r As Double
-
-
If p < 0 Or p > 1 Then
-
NormSInv = 0
-
ElseIf p < p_low Then
-
q = Sqr(-2 * Log(p))
-
NormSInv = (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
ElseIf p <= p_high Then
-
q = p - 0.5: r = q * q
-
NormSInv = (((((a1 * r + a2) * r + a3) * r + a4) * r + a5) * r + a6) * q / _
-
(((((b1 * r + b2) * r + b3) * r + b4) * r + b5) * r + 1)
-
Else
-
q = Sqr(-2 * Log(1 - p))
-
NormSInv = -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / _
-
((((d1 * q + d2) * q + d3) * q + d4) * q + 1)
-
End If
-
End Function
SAMPLE OUTPUT: - ID p_value Inv_Norm_Cum
-
1 0.2 -0.841621232726609
-
2 0.3 -0.524400513279294
-
3 0.4 -0.253347102859999
-
4 0.45 -0.125661346876103
-
5 7 0
I ended up using the following to get the Sigma Rating: - Sigma: (0.8406+Sqr(29.37-2.221*(Log([PPM]))))
Thanks for your help, though.
JJ
I ended up using the following to get the Sigma Rating: - Sigma: (0.8406+Sqr(29.37-2.221*(Log([PPM]))))
Thanks for your help, though.
JJ
You're quite welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: phil_gg04 |
last post by:
Dear Javascript Experts,
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function...
|
by: laredotornado |
last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to
have my Javascript function execute from the BODY's "onload" method,
but if there is already an onload method defined, I would...
|
by: sushil |
last post by:
+1 #include<stdio.h>
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
|
by: Olov Johansson |
last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7
and Konqueror 3.5) has support not only for standard function
definitions, function expressions (lambdas) and Function...
|
by: Beta What |
last post by:
Hello,
I have a question about casting a function pointer. Say I want to make
a generic module (say some ADT implementation) that requires a function
pointer from the 'actual/other modules'...
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: ...
|
by: Larax |
last post by:
Best explanation of my question will be an example, look below at this
simple function:
function SetEventHandler(element)
{
// some operations on element
element.onclick =
function(event)
{
|
by: alex |
last post by:
I am so confused with these three concept,who can explained it?thanks
so much?
e.g.
var f= new Function("x", "y", "return x * y");
function f(x,y){
return x*y
}
var f=function(x,y){
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |