Niels Steen Krogh
2004-Mar-01 01:23 UTC
[R] glm logistic model, prediction intervals on impact af age 60 compared to age 30
Dear R-list. I have done a logistic glm using Age as explanatory variable for some allergic event. #the model model2d<-glm(formula=AEorSAEInfecBac~Age,family=binomial("logit"),data=emrisk) #predictions for age 30 and 60 preds<-predict(model2d,data.frame(Age=c(30,60)),se.fit=TRUE) # prediction interval predsxx<-cbind(fit=preds$fit,lower=preds$fit-1.96*preds$se,upper=preds$fit+1.96*preds$se) #transformation model2dres<-family(model2d)$linkinv(predsxx) In my next step I want to know the confidence interval (CI) for the change in risk for the allergic event to occur for age 60 compared to age 30. The estimates from the model suggest a 80 pct. higher risk for age 60 compared to age 30. (100*model2dres[2]/model2dres[1]) But how should I get the 95% CI of the 80pct. increase?? I've looked in the effects package but did'nt find an answer. Any hints? R 1.8.1. Windows Cand. Polit. Niels Steen Krogh Solsortvej 44 2000 F. Tlf: 3888 8613 ZiteLab / EmpoweR youR data with R, Zope and SOAP
Prof Brian Ripley
2004-Mar-01 07:35 UTC
[R] glm logistic model, prediction intervals on impact af age 60 compared to age 30
As I understand what you have done, model2dres are probabilities, not risks. Since this is a logistic regression, you want to interpret the results via log odds (or odds). The log odds of an event at age 60 vs age 30 are just 30x the coefficient for Age. On Mon, 1 Mar 2004, Niels Steen Krogh wrote:> Dear R-list. > I have done a logistic glm using Age as explanatory variable for some > allergic event. > > #the model > model2d<-glm(formula=AEorSAEInfecBac~Age,family=binomial("logit"),data=emrisk) > #predictions for age 30 and 60 > preds<-predict(model2d,data.frame(Age=c(30,60)),se.fit=TRUE) > # prediction interval > predsxx<-cbind(fit=preds$fit,lower=preds$fit-1.96*preds$se,upper=preds$fit+1.96*preds$se) > #transformation > model2dres<-family(model2d)$linkinv(predsxx) > > > In my next step I want to know the confidence interval (CI) for the change > in risk for the allergic event to occur for age 60 compared to age 30. > The estimates from the model suggest a 80 pct. higher risk for age 60 > compared to age 30. > (100*model2dres[2]/model2dres[1]) > > But how should I get the 95% CI of the 80pct. increase?? > > I've looked in the effects package but did'nt find an answer.You would need the covariance of those estimates to do so in the asymptotic setting (and you would need to get that from first principles), but unless your effects have been estimated very precisely the non-linearity is likely to make any confidence intervals you derived pretty inaccurate. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595