| If you have visited this
page before and wish to skip the preamble, click here to go
directly to the calculator. |
| X: | gestational age of the infant (in weeks)
at the time of birth [column (i)]; and | |
| Y: | whether the infant was breast feeding at
the time of release from hospital ["no" coded as "0" and entered in
column (ii); "yes" coded as "1" and entered in
column (iii)] |
| (v) | the observed probability of Y=1 for each
level of X, calculated as the ratio of the number of instances of Y=1
to the total number of instances of Y for that level; | |
| (vi) | the odds ratio for each level of X,
calculated as the ratio of the number of Y=1 entries to the number of Y=0
entries for each level, or alternatively as |
| observed probability
(1 - observed probability) |
| and | ||
| (vii) | the natural logarithm of the odds ratio
for each level of X, designated as "log odds
ratio." |
| i | ii | iii | iv | v | vi | vii |
| X | Instances of Y Coded as | Total ii+iii | Y as Observed Probability | Y as Odds Ratio | Y as Log Odds Ratio | |
| 0 | 1 | |||||
| 28 29 30 31 32 33 | 4 3 2 2 4 1 | 2 2 7 7 16 14 | 6 5 9 9 20 15 | .3333 .4000 .7778 .7778 .8000 .9333 | .5000 .6667 3.5000 3.5000 4.0000 14.0000 | -.6931 -.4055 1.2528 1.2528 1.3863 2.6391 |
A. Ordinary Linear
Regression![]() | B. Logistic
Regression![]() |
| X | Observed Probability | Log Odds Ratio | Weight | C. Weighted Linear Regression
of C. Observed Log Odds Ratios on X ![]() |
| 28 29 30 31 32 33 | .3333 .4000 .7778 .7778 .8000 .9333 | -.6931 -.4055 1.2528 1.2528 1.3863 2.6391 | 6 5 9 9 20 15 | |
| For
each level of X, the weighting factor is the number of observations
for that level. | ||||
| Intercept=-17.2086 is the point on the Y-axis (log odds ratio)
crossed by the regression line when X=0.
Slope=.5934 is the rate at which the predicted log odds ratio increases (or, in some cases, decreases) with each successive unit of X. Within the context of logistic regression, you will usually find the slope of the log odds ratio regression line referred to as the "constant." The exponent of the slope exp(.5934) = 1.81 describes the proportionate rate at which the predicted odds ratio changes with each successive unit of X. In the present example, the predicted odds ratio for X=29 is 1.81 times as large as the one for X=28; the one for X=30 is 1.81 times as large as the one for X=29; and so on. | ||||
| log[OR]=-17.2086+(.5934x31)=1.1868 |
| OR=exp(log[OR])=exp(1.1868)=3.2766 |
| probability=OR/(1+OR)=3.2766/(1+3.2766)=.7662 |
![]() | ![]() |
and on others of what Freud described as the narcissism of small
differences. The second reason is that in most real-world cases there is little
if any practical difference between the results of the two methods. The blue
line in the adjacent graph is the same empirical regression line described
above; the red line shows the regression resulting from the method of maximized
log likelihood. I find it difficult to suppose that the fine-tuned
abstraction of the latter is saying anything very different from what is being
said by the former. | X | Instances of Y Coded as | Enter the values of X into the designated cells. beginning
with the top-most cell. Then, for each level of X, enter the number
of instances coded as 0 and 1. When all values have been entered,
click the «Calculate 1» button.
Note that all entries in the "0" and "1" cells associated with an entered value of X must be positive integers greater than zero. If a zero is entered into any of these cells, it will be replaced by "1" and the adjacent cell will be incremented by 1. For an illustration of data entry, click here to enter the data described in the introductory example. | |
| 0 | 1 | ||
| intercept: |
| X | Probabilities | Odds Ratios | ||
| Observed | Predicted | Observed | Predicted | |
| X | Predicted | To calculate the predicted
probability and odds ratio for any particular value of X, enter X into the designated cell, then click the «Calculate 2» Button. | ||
| Probability | Odds Ratio | |||