Actually, I am trying to recover an example in a textbook via Mathematica. The situation is to study the relationship between esophagus cancer and smoking as well as excessive drinking. And the original data is quite simple:
data = {{0, 0, 199, 63, 136}, {0, 1, 170, 63, 107}, {1, 0, 101, 44, 57}, {1, 1, 416, 265, 151}}; where in each row (sub-list), the entries are for x1 (smoking: no-0, yes-1), x2 (excessive drinking: no-0, yes-1), total number, number of positive and number of negative (total number = number of positive + number of negative).
The textbook gives, e.g., the estimate and standard error of the linear coefficients b0 (Intercept), b1 and b2 as (picture coming from http://statpages.info/logistic.html)
However, when I use LogitModelFit (which accepts data with structure {{x1, x2, y},...}, and y is the ratio of positive samples: number of positive / total number) with the below new data
dataNew = {{0., 0., 0.316583}, {0., 1., 0.370588}, {1., 0., 0.435644}, {1., 1., 0.637019}}; logitM = LogitModelFit[dataNew, {x1, x2}, {x1, x2}]; Then logitM["ParameterTable"] gives
The problem is that the results obtained by Mathematica do not accord with those by the textbook.
So my first questions are:
Have I used
LogitModelFitcorrectly?How could one get the consistent results as shown in the first picture?
P.S. I am using Windows 10 and Mathematica 11.2.
------------------------------
Conclusion to Question 1: I indeed did not use LogitModelFit correctly.
Conclusion to Question 2: See the selected answer.
And thanks a lot to @JimB and @J. M..


