4
$\begingroup$

I'm trying to teach myself how to quickly translate many different types of equations into VB, T-SQL and MDX code. Since I'm trying to build a skill, not just solve a single isolated problem, I'm try to figure this stuff out on my own as much as possible - but I'm stumped by the error function used in the calculation of the normal cumulative distribution function. In the equation I retrieved from the Wikipedia page "Normal Distribution," there is a $t$ symbol ($-t^2$, actually) which I can't find any references on.

$$\text{erf}(x)=\frac{1}{\sqrt{(\pi)}}\int_{-x}^x\exp(-t^2)dt$$

Can anyone tell me what it means, and how to derive that value if it's not obvious? I can't figure out if it's a common calculus symbol or a measure used in statistics. Could it be one of the parameters used in integral differentiation, as mentioned at http://en.wikipedia.org/wiki/Parameter and http://en.wikipedia.org/wiki/Differentiation_under_the_integral_sign ?

In addition, I've read that the CDF for a normal distribution is difficult to define precisely, so approximations based on things like Taylor Series and McLaurin Series are used. I want to figure out how to code such things on my own, if possible, but I was wondering if anyone had any thoughts on which method might be higher performing and which would yield greater precision.

$\endgroup$
2
  • 1
    $\begingroup$ I found a nice paper, "Computation of the error function erf in arbitrary precision with correct rounding, S. Chevillard & N. Revol" which is quite accessible. They start out by giving a straightforward sum from n=0 to infinity, which you can implement in 10 minutes, and then spend 3 pages discussing how to improve that. $\endgroup$
    – MSalters
    Aug 14, 2014 at 22:53
  • $\begingroup$ Thanks MSalters, I followed your suggestion and found that paper pretty quickly on Google. It's perfect - I'm going to work through the examples in it until I have a clearer understanding. On and off for the last several weeks I've found many sources with the same equation, but none of them had examples in the same league as the Chevillard/Revol paper. I'm pretty confident I can calculate some CDFs, now that I have that, plus the complementary explanations by Scortchi, Glen B and Alecos, each of which helped a little. Thanks again. $\endgroup$ Aug 15, 2014 at 2:37

3 Answers 3

4
$\begingroup$

$t$ is just a place-holder for a number: you're integrating the function $\mathrm{e} ^{-t^2}$ from $t=-x$ to $t=x$. The reason it's not defined where you read it is that to evaluate the error function $\operatorname{erf}(x)$ you need to provide a value for $x$, but not for $t$, which is a bound variable—it plays a purely internal role in the function. It's like $k$ in this formula for the sum of the first $n$ integers: $$\sum_{k=1}^{k=n} k=\frac{n(n+1)}{2}$$

PS Nothing to do with differentation under the integral sign, just plain integration.

PPS In the terminology of the Wikipedia article, $x$ is the "parameter on which the integration depends" & $t$ is the "parameter of integration" a.k.a. dummy variable (I've never heard of "parameter of integration" before").

$\endgroup$
3
  • $\begingroup$ Thanks - So basically if I have a value for x and want to plug it in to the function, it would go in the spot where the t symbol is? Also, just for future reference, would that be considered as an example of the kind of parameters mentioned at en.wikipedia.org/wiki/Parameter etc.? $\endgroup$ Aug 14, 2014 at 15:50
  • 1
    $\begingroup$ @SQLServerSteve No, you would not substitute $x$ in there - it's not a function of $t$ any more than $\sum_{k=1}^{k=n} k=\frac{n(n+1)}{2}$ is a function of $k$. In fact the expression is already a function of $x$, and so if you had a value for $x$, you'd replace $x$ with that number. $\endgroup$
    – Glen_b
    Aug 14, 2014 at 20:39
  • $\begingroup$ Thanks for straightening me out on that Glen - I had it backwards LOL. I found the paper by Chevillard and Revol that MSalters mentioned above, which is a tutorial of sorts - I'll work through it to make sure I've got a better grasp on the concept. Thanks again. $\endgroup$ Aug 15, 2014 at 2:29
3
$\begingroup$

As per $t$, it is indeed the "dummy variable of integration" -and we use it extensivelty in CDF's to avoid confusion with the limit of the integral, i.e. instead of writing

$$P(X\leq x) =\int_{-\infty}^x f(x)dx$$

we write

$$P(X\leq x) =\int_{-\infty}^x f(t)dt$$

since it is rather awkward to write something that verbally would translate into "$x$ ranges from minus infinity to $x$"

As for approximating the normal CDF, ch. 3 of Patel, J. K., & Read, C. B. (1996). Handbook of the normal distribution. has I believe relevant information.

$\endgroup$
4
  • $\begingroup$ Thanks - I think I get it now, thanks to the combination of Scortchi's answer with yours. :) I'll check out that source as well, when I get a chance. I'd upvote both of your answers, but as a newbie I don't have enough rep points yet. $\endgroup$ Aug 14, 2014 at 15:56
  • $\begingroup$ @SQLServerSteve: Even if you cannot upvote yet, you can already "accept" answers (by clicking on a green tick on the left) once you think your question is resolved. $\endgroup$
    – amoeba
    Aug 14, 2014 at 18:31
  • $\begingroup$ Thanks amoeba, I missed that - I'll mark Scortchi's answer since it was first, even though Alecos' was also equally helpful :) $\endgroup$ Aug 14, 2014 at 18:33
  • $\begingroup$ The important thing is to use your voting powers! -as @amoeba pointed out. $\endgroup$ Aug 14, 2014 at 18:37
1
$\begingroup$

Imagine someone came to you with some complicated 2D shape, and wanted to find the area of it.

You tell them "Oh, here's a way you can approximate it - put a grid of tiny squares over it and count how many squares are contained inside its boundary."

To keep things straight (so they don't count haphazardly), you then lead then through numbering the squares, row by row.

The $t$ is in effect playing the role of "which square are we up to?"

Clearly it plays no role whatever in the value of the area (since you could change the numbering order without changing the area nor your estimate of it). It's just a placeholder (a 'dummy variable'). The area isn't a function of $t$, it is just approximated by an approach that is using it as a way of keeping track of where you are in the calculation.

$\endgroup$
2
  • $\begingroup$ That also helps - I've been getting in a lot of practice with writing code with summation and product operators lately, but this is the first time I've run into an equation with a placeholder of this kind. Now that you guys have explained it it actually seems fairly simple (I suspected that would be the case - if t wasn't a simple, commonly understood thing, the other websites I went to for explanations would have probably spelled out exactly what t was, LOL). I think I've got it now - but I'll work through the Chevillard/Revol paper to make sure. :) $\endgroup$ Aug 15, 2014 at 2:42
  • $\begingroup$ Actually, it's a very commonly misunderstood thing. Lots of people are confused by the dummy in summation or integration in this fashion. $\endgroup$
    – Glen_b
    Aug 15, 2014 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.