[R] how to obtain the OR and 95%CI with 1 SD change of a continue variable

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Mon Jun 18 17:27:25 CEST 2007


felix wrote:
> Dear all,
>
> How to obtain the odds ratio (OR) and 95% confidence interval (CI) with 
> 1 standard deviation (SD) change of a continuous variable in logistic 
> regression?
>
> for example, to investigate the risk of obesity for stroke. I choose the 
> happening of stroke (positive) as the dependent variable, and waist 
> circumference as an independent variable. Then I wanna to obtain the OR 
> and 95% CI with 1 SD change of waist circumference.how?
>
> Any default package(s) or options in glm available now?
>
> if not, how to calculate them by hand?
>
>   
Unless you want to do something advanced like factoring in the sampling
error of the SD (I don't think anyone bothers with that), probably the
easiest way is to scale() the predictor and look at the relevant line of
exp(confint(glm(.....))). As in

(library(MASS); example(confint.glm))

> budworm.lg0 <- glm(SF ~ sex + scale(ldose), family = binomial)
> exp(confint(budworm.lg0))
Waiting for profiling to be done...
                 2.5 %     97.5 %
(Intercept)  0.2652665  0.7203169
sexM         1.5208018  6.1747207
scale(ldose) 4.3399952 10.8983903

Or, if you insist on getting asymptotic Wald-statistic based intervals:

> exp(confint.default(budworm.lg0))
                2.5 %     97.5 %
(Intercept)  0.269864  0.7294944
sexM         1.496808  6.0384756
scale(ldose) 4.220890 10.5546837

You can also get it from the coefficients of the unscaled analysis, like in

> budworm.lg0 <- glm(SF ~ sex + ldose, family = binomial)
> confint(budworm.lg0)
Waiting for profiling to be done...
                 2.5 %    97.5 %
(Intercept) -4.4582430 -2.613736
sexM         0.4192377  1.820464
ldose        0.8229072  1.339086
> exp(confint(budworm.lg0)[3,]*sd(ldose))
Waiting for profiling to be done...
    2.5 %    97.5 %
 4.339995 10.898390


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list