[R] confint: which method attached?

Ulrich Halekoh Ulrich.Halekoh at agrsci.dk
Mon Nov 17 13:24:23 CET 2003




the function
confint
uses the profiling method of the function of the package MASS
 
confint.glm

even after the package has been detached!

1: might this be the intenden behavior?

2. How does the function remember its 'MASS' functionality after detaching the package?

R: 1.8.0; Windows 2000



Here is a sample program


> set.seed(7882)
> x<-rep(c(0,1),c(20,20))
> p<-plogis(2+0.1*x)
> y<-cbind(event,50-rbinom(length(p),50,p))
> xf<-factor(x)
> g<-glm(y~xf,family=binomial)
> 
> # conficence intervals according base package:
> print(confint(g))
                 2.5 %    97.5 %
(Intercept) 1.65425534 2.0266122
xf1         0.06324695 0.6282106
> 
> library(MASS)
> print(confint(g))
Waiting for profiling to be done...
                 2.5 %    97.5 %
(Intercept) 1.66398057 2.0247678
xf1         0.07341592 0.6210034
> 
> detach(package:MASS)
> print(search())
[1] ".GlobalEnv"      "package:methods" "package:ctest"   "package:mva"    
[5] "package:modreg"  "package:nls"     "package:ts"      "Autoloads"      
[9] "package:base"   
> print(confint(g))
Waiting for profiling to be done...
                 2.5 %    97.5 %
(Intercept) 1.66398057 2.0247678
xf1         0.07341592 0.6210034


Ulrich Halekoh, PhD
Institute of Agricultural Sciences, Biometry Group
8830 Tjele, Denmark,
ulrich.halekoh at agrsci.dk




More information about the R-help mailing list