I've made a probit regression model using a statistical package. I'de like to use Teradata to score our customers. For this I need a function that converts a real value to a probability value (value between 0 and 1) based on the normal distribution. Is there such a function, or method to do this in Teradata SQL? In Excel for example this function is called NORMDIST().
Have you heard any response regarding normal distribution in Teradata? I am looking to do the same thing bank accounts balances
If you only need the PDF:
Probability density function for Normal Distribution
REPLACE FUNCTION NormDist
val NUMBER -- Value to be evaluated
,Mean NUMBER -- Mean of the Normal Distribution
,StdDev NUMBER -- Standard Deviation of the Normal Distribution
SQL SECURITY DEFINER
INLINE TYPE 1
EXP(-0.5*(val-Mean)*(val-Mean) / (StdDev*StdDev)) / (2.506628274631 /*=SQRT(2.*PI()*/ *StdDev);
To get the Cumulative PDF you need to implement a C-UDF.
Is it possible to get the integral of this function in Teradata?we need the probability distribution function, and that would be the integral of the density function.
In Excel sheet this calcultation can be done with DISTR.NORM.ESTAND.N functions, and INV.NORM.ESTAND for the inverse function.
NORM.S.INV is the Cumulative distribution, there's no way to calculate an integral in SQL.
A quick serach shows some solutions for SQL Server, which might be easily adopted to Teradata (lots of Search&Replace to get a single calculation):
But of course the simplest and most efficient way would be wrapping one of the many C-implemetations into a UDF.