[R] logit regression, test among groups

Frank E Harrell Jr fharrell at virginia.edu
Tue May 28 14:31:41 CEST 2002


I do this by getting two predicted values and the design matrix for each (to get standard errors).  In the Design library you can do

f <- lrm(p.a ~ spp*log(light))
contrast(f, list(spp=3,light=1), list(spp=2,light=1))
# Contrasts spp=3 vs spp=2 to get odds ratio, setting light=1

You can also request that contrast give you a vector of contrasts for varying light.

You could also do this task with glm.  I don't like to refit models just to get desired contrasts.  Predicted values go a long way.

Frank Harrell

On Tue, 28 May 2002 06:59:23 -0400
"Martin Henry H. Stevens" <HStevens at muohio.edu> wrote:

> 
> Dear all:
> My logistic regression model includes one qualitative and one quantitative 
> predictor variable,
> 
> aes <- glm(p.a ~ spp * log(light), family=binomial(link=logit)),
> 
> where spp is abundance of 3 species and light is subcanopy light 
> availability varying from 0  1.
> 
>   I want to test differences among levels of the quantitative variable at a 
> value of x other than the current log(light)=0.  I tried using 
> I(log(light+.5)) but this caused serious lack of fit (AIC went from 1574 to 
> 1656, and diagnostic plots demonstrated poor fit). How would create a model 
> statement such that I test differences among groups at log(light)=approx. 2?
> Many thanks.
> 
> Martin Henry H. Stevens, Assistant Professor
> 338 Pearson Hall
> Botany Department
> Miami University
> Oxford, OH 45056
> 
> Office: (513) 529-4206
> Lab: (513) 529-4262
> FAX: (513) 529-4243
> http://www.muohio.edu/~botcwis/bot/henry.html
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list