[R] the observed "log odds" in logistic regression

Dieter Menne dieter.menne at menne-biomed.de
Tue Dec 11 08:43:47 CET 2007


Bin Yue <leffgh <at> 163.com> writes:

>      After reading the following two links:
> http://luna.cas.usf.edu/~mbrannic/files/regression/Logistic.html
> http://www.tufts.edu/~gdallal/logistic.htm
>      I've known the mathematical basis for logistic regression.However I am
> still not so sure about the "logit "
>      For a categorical independent variable, It is  easy to understand the
> procedures  how "log odds" are calculated. As I know, First the observations
> are grouped according to the IV and DV, generating a contingency table.
..
>    My problem  is this : in my data set , the IVs are continuous variables,
> do I still have to generate such a table and compute the log odds for each
> level of IV according to which the log odds are calculated?  

Let's assume you are going to use glm in package stats. glm can be fed with 
data in three ways; in your case, you should use the "one-row/one 0-1 event"
format, that is the "long" style. You do not have to compute any logit, 
glm will do that for your.

The example coming closest to your's is the birthwt example in 
MASS/scripts/ch07.R  and chapter 7 in Venables/Ripley MASS. Try to generate 
a small, self-running example with a data set similar to your's, and you have 
a good chance to get a more detailed answer.

Dieter



More information about the R-help mailing list