Niels Steen Krogh
2004-Feb-28 07:22 UTC
[R] logististic regression (GLM). How to get 95 pct. confidence limits?
Dear R-list. I'm doing af logistic analyses using gml. The model explaines variations in Adverse events infections (0 og 1) using age as explanatory variable. model2d<-glm(formula=AEorSAEInfecBac~Age,family=binomial("logit"),data=emrisk) I want to get predictions with 95% confidence limits for age 30 and age 60. I've been reading the "google" and "search r-project" for suggestions but could only find solutions for lm: predict(model,data.frame(Age=30),level=.95 ..............) ?predict.glm or ?glm did'nt give me hints either. Using R1.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-Feb-28 08:17 UTC
[R] logististic regression (GLM). How to get 95 pct. confidence limits?
On Sat, 28 Feb 2004, Niels Steen Krogh wrote:> Dear R-list. > I'm doing af logistic analyses using gml. > The model explaines variations in Adverse events infections (0 og 1) using > age as explanatory variable. > > model2d<-glm(formula=AEorSAEInfecBac~Age,family=binomial("logit"),data=emrisk) > > I want to get predictions with 95% confidence limits for age 30 and age 60. > I've been reading the "google" and "search r-project" for suggestions but > could only find solutions for lm: predict(model,data.frame(Age=30),level=.95 > ..............) > ?predict.glm or ?glm did'nt give me hints either.95% confidence limits for what? I guess you mean either the linear predictor or the mean, and it is preferable to find CIs for the linear predictor and transforms the CIs if needed. preds <- predict(model2d, data.frame(Age=c(30, 60)), se.fit=TRUE) will give a list with means and ses for the linear predictor. There is no exact sampling theory, so you can use something like cbind(lower=pred$fit-1.96*preds$se, upper=pred$fit+1.96*preds$se) and transform by family(model2d)$linkinv() to response scale. -- 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
Christian Schulz
2004-Feb-28 08:32 UTC
[R] logististic regression (GLM). How to get 95 pct. confidence limits?
Hi, in library(MASS) the function profile.glm should help you. christian Am Samstag, 28. Februar 2004 08:22 schrieb Niels Steen Krogh:> Dear R-list. > I'm doing af logistic analyses using gml. > The model explaines variations in Adverse events infections (0 og 1) using > age as explanatory variable. > > model2d<-glm(formula=AEorSAEInfecBac~Age,family=binomial("logit"),data=emri >sk) > > I want to get predictions with 95% confidence limits for age 30 and age 60. > I've been reading the "google" and "search r-project" for suggestions but > could only find solutions for lm: > predict(model,data.frame(Age=30),level=.95 ..............) > ?predict.glm or ?glm did'nt give me hints either. > > > Using R1.8.1. Windows > > > > > > Cand. Polit. > Niels Steen Krogh > Solsortvej 44 > 2000 F. > > Tlf: 3888 8613 > > ZiteLab / EmpoweR youR data with R, Zope and SOAP > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
Apparently Analagous Threads
- glm logistic model, prediction intervals on impact af age 60 compared to age 30
- sorting with criteria that are "out of order"
- centile reference chart / clildren growth chart - what package/method to use
- howto improve sharpeness of fonts in a jpg-image produced by R ?
- problem in installing R packages on linux