9
$\begingroup$

Apologies for the rudimentary question. I haven't studied math and can't find an answer to this online.

Is the '$e$' in this equation for logistic regression Euler's number? If so, it doesn't matter how I calculate this; I can't get the same result. Could someone walk me through it? If I try to calculate this with a scientific calculator, I get all sorts of wrong answers — possibly because I am not using brackets in the right way. Really, I have done no maths at all!

$$\frac{e^{\color{red}{-2.91}+\color{blue}{6.26}*\color{green}{0.1}}}{1+e^{\color{red}{-2.91}+\color{blue}{6.26}*\color{green}{0.1}}} = 0.0924$$

$\endgroup$
8
  • 2
    $\begingroup$ Yes, it is Euler's number. $\endgroup$
    – Mark Viola
    Jun 6, 2017 at 19:07
  • 3
    $\begingroup$ Do you get a different value? I just computed it, using the standard definition of $e$ of course, and got $0.092456771$. $\endgroup$
    – lulu
    Jun 6, 2017 at 19:09
  • 2
    $\begingroup$ Worth noting that this not technically an "equation", since it doesn't contain a variable. $\endgroup$
    – imallett
    Jun 6, 2017 at 21:19
  • 5
    $\begingroup$ @imallett: I see no reason to exclude the trivial case of no variables from the term equation, when any other natural number would be allowed. $\endgroup$
    – wnoise
    Jun 7, 2017 at 0:47
  • 2
    $\begingroup$ @wnoise Not that wikipedia is in any way authorative on the field, but the first sentence of their page on equations reads "In mathematics, an equation is a statement of an equality containing one or more variables." That meing said, $2x = x+x$ is certainly an equation, and if you reduce it to $0 = 0$, I don't think it should stop being an equation just because all the variables happened to cancel out. $\endgroup$
    – Arthur
    Jun 7, 2017 at 7:46

4 Answers 4

15
$\begingroup$

If you're having a hard time getting the same numeric result for that expression, it might be because you're not entering it correctly on a calculator. To get the correct value, you need to use parentheses in the right places.

Using a computer, or a TI graphing calculator, you would enter the expression this way:

e^(-2.91+6.26*0.1)/(1+e^(-2.91+6.26*0.1))

If you do that, you should get the right numeric value.

$\endgroup$
1
  • 1
    $\begingroup$ You can also just paste that expression into the Google search bar. $\endgroup$ Jun 7, 2017 at 14:04
6
$\begingroup$

This is the Euler's constant. It is approximately $2.718281828459$... You can read more on it here:

https://en.wikipedia.org/wiki/E_(mathematical_constant)

$\endgroup$
1
  • 2
    $\begingroup$ To me, the term "Euler's constant" refers to another constant, $\gamma = 0.57721566\ldots$. I know some people have a different terminology. What we are talking about here, $e=2.7182818\ldots$, is often just called "the number $e$", or the base of the natural exponential (or natural logarithm) function. After learning more about it, one can clarify by writing $e=\exp(1)$ (but this will not help someone who does not know $e$ in advance). $\endgroup$ Jun 6, 2017 at 21:57
5
$\begingroup$

Here $e$ is Euler's number, ($e \approx 2.718$) and that is the correct answer to the equation, so you might need to double check your work. If you don't use enough digits of $e$ (i.e. $e \approx 2.7$ evaluates to $0.09375\dots$), then your answer will be off.

Wolfram Alpha confirms that:

$$ \frac{e^{-2.91 + 6.26\cdot 0.1}}{1 + e^{-2.91 + 6.26\cdot 0.1}} = 0.0924568 $$

$\endgroup$
2
$\begingroup$

Though the accepted answer certainly gives a good explanation of getting near the equation's stated "result", I think it's worth noting some points on rounding and errors here.

First, as this is a site for mathematicians, let's take their point of view; typically, mathematicians use arbitrary* precision in the constants and intermediate values in their equation - think calculator value. This is good because it avoids rounding errors. Irrational answers like the answer to this equation can then be given to a reasonable number of significant figures, in this case, that's 3 (answer is of the form 0.0###). So what does happen when we evaluate the equation with high precision and round the answer to 3s.f? $$ \frac{e^{-2.91 + 6.26\cdot 0.1}}{1 + e^{-2.91 + 6.26\cdot 0.1}} \approx 0.0924568 = 0.0925 (3s.f.)$$ Note this is not the original 0.0924 from OP's equation.

Now what's probably happened is that the person writing the question has used a calculator value for e and ended up with this: 0.0924568... to which they've done this: 0.0924568... and that's given the (IMO wrong) "answer" to OP's equation.

But there are a few other approaches to errors and uncertainty that I'd like to highlight before writing the equation off as just plain wrong

*When I say "arbitrary precision", what I really mean is enough sig figs so that changing any of the later values will not affect the rounded calculation result. In this example, that happens with e to 6s.f., and so for e = 2.71828... it makes no difference whether that ... is a 9 or a 0 or anything else, the result will be the same when rounded.


Method 1: the Engineer

Nothing is perfect in engineering, the equation as stated may be using a rounded value for e. All numbers in the equation are given to 3s.f. (at least, 1 and 0.1 aren't, but let's pretend they are). So logically a 3s.f. value for e of 2.72 should be used. This gives us the answer 0.0923357... = 0.0923 (3s.f.), also not in agreement.

Method 2: the Physicist

A Physicist is an Engineer applying the rules more rigorously. In fact, as a Physicist, you tend to take all numbers in the equation to no more than 1s.f. greater accuracy than your answer. And the answer should have no greater accuracy than the least accurate number in your equation - which for us is 1s.f. for either 1 or 0.1. Therefore, the greatest accuracy of any of the numbers in our equation should be no more than 2s.f. in order to get a 1s.f. answer. With that in mind, our equation should have looked like: $$ \frac{e^{-2.9 + 6.3\cdot 0.1}}{1 + e^{-2.9 + 6.3\cdot 0.1}} = (0.0924 \ rounded \ to \ 1s.f.) = 0.09$$ and e can be either 3 or 2.7. Testing both of those $$f(e=3) = 0.08(1s.f.)$$ $$f(e=2.7) = 0.09(1s.f.)$$

The 1s.f. version of the 0.0924 in the original question is 0.09, so the physicist taking values to 2s.f. would be fine seeing OP's equation if it was written as $$ \frac{e^{-2.9 + 6.3\cdot 0.10}}{1.0 + e^{-2.9 + 6.3\cdot 0.1}} = 0.09$$

Method 3:the Biologist

Finally, biologists like decimal places, and similar to what physicists say about sig figs, a biologist would expect an answer with the same number of dps as the least accurate bit of data in the equation. Well if 1 was measured to 0 dps, then actually, the equation the biologist is looking to confirm is whether $$ \frac{e^{-3 + 6\cdot 0}}{1 + e^{-3 + 6\cdot 0}} = (0.0924 \ to \ 0d.p.) = 0$$ Which is true for e to 0 d.p, or to any precision


Now I'll admit that most of that was a bit silly, that's clearly not what was meant in the question the OP posed, but I do think it's important to have an appreciation of precision in answers and to see that depending on how you construct the equation you can get many different answers. Also as a caveat, I'm not claiming to speak for all Biologists, Engineers or Physicists, I just put those labels to help illustrate the point.

NB, this word document is a good resource for info on uncertainties and errors in physics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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