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

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Tue, 11 Dec 2007 07:43:47 +0000 (UTC)

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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 11 Dec 2007 - 08:03:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Dec 2007 - 08:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.