Hi all! I am trying to develop a plot a figure in which I would like to show the odds ratios obtained from a logistic model. I have tried with the dotplot option but no success. Could you help me? Is there any option when modelling the logistic model in R? Thank you in advance

Steve Lianoglou

2010-Feb-06 19:57 UTC

### [R] Plot of odds ratios obtained from a logistic model

Hi, On Sat, Feb 6, 2010 at 1:28 PM, gepeto <geppetto5st at gmail.com> wrote:> Hi all! > > I am trying to develop a plot a figure in which I would like to show > the odds ratios obtained from a logistic model. I ?have tried with the > dotplot option but no success. Could you help me?You can help us help you by showing the code you tried with dotplot that didn't turn out as you expected ... it's easier to help you get where you're going if you showed us the direction you started in ..> Is there any option when modelling the logistic model in R?I'm sure there are many. Take a look at some of the graphics from: http://addictedtor.free.fr/graphiques/ http://bm2.genes.nig.ac.jp/RGM2/index.php http://had.co.nz/ggplot2/ And look at the source code/man pages of the graphs that are of the type you'd like to make, and take it from there. Including code + a reproducible example (even if it doesn't work) will get you a long way ... -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact

David Freedman

2010-Feb-06 21:13 UTC

### [R] Plot of odds ratios obtained from a logistic model

You might want to look at the plot.Predict function in the rms package - it allows you to plot the logits or probablities vs the predictor variable at specified levels of other covariates (if any) in the model. There are many examples in http://cran.r-project.org/web/packages/rms/rms.pdf David Freedman -- View this message in context: http://n4.nabble.com/Plot-of-odds-ratios-obtained-from-a-logistic-model-tp1471496p1471566.html Sent from the R help mailing list archive at Nabble.com.

David Winsemius

2010-Feb-06 21:22 UTC

### [R] Plot of odds ratios obtained from a logistic model

On Feb 6, 2010, at 4:13 PM, David Freedman wrote:> > You might want to look at the plot.Predict function in the rms > package - it > allows you to plot the logits or probablities vs the predictor > variable at > specified levels of other covariates (if any) in the model. There > are many > examples in http://cran.r-project.org/web/packages/rms/rms.pdfBut it will not work on a glm( ..., family=binomial) object. To work with such an object you would need to plot exp(fit$linear.predictors) or fit$fitted.values plot.Predict will only work with the functions in the rms package, ... in the case of logistic models that would be lrm().> > David Freedman > -- > View this message in context: http://n4.nabble.com/Plot-of-odds-ratios-obtained-from-a-logistic-model-tp1471496p1471566.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT

Frank E Harrell Jr

2010-Feb-06 23:29 UTC

### [R] Plot of odds ratios obtained from a logistic model

Also take a look at summary.rms and its plot method which produces odds ratio dot charts directly. Frank David Winsemius wrote:> > On Feb 6, 2010, at 4:13 PM, David Freedman wrote: > >> >> You might want to look at the plot.Predict function in the rms package >> - it >> allows you to plot the logits or probablities vs the predictor >> variable at >> specified levels of other covariates (if any) in the model. There are >> many >> examples in http://cran.r-project.org/web/packages/rms/rms.pdf > > But it will not work on a glm( ..., family=binomial) object. To work > with such an object you would need to plot exp(fit$linear.predictors) or > fit$fitted.values > > plot.Predict will only work with the functions in the rms package, ... > in the case of logistic models that would be lrm(). > >> >> David Freedman >> -- >> View this message in context: >> http://n4.nabble.com/Plot-of-odds-ratios-obtained-from-a-logistic-model-tp1471496p1471566.html >> >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> 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. > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > ______________________________________________ > 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. >-- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University

### Apparently Analagous Threads

- Odds ratios from lrm plot
- Difficulty getting standard deviation of ALL odds ratios with glm function, logistic regression, need cov of parameters
- Calculating odds ratios from logistic GAM model
- Obtaining R-squared value in Logistic Regression
- [Q] Goodness-of-fit test of a logistic regression model using rms package