[R] calculating likelihood-based CI
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Wed May 15 10:07:36 CEST 2002
On Wed, 15 May 2002, vito muggeo wrote:
> Hi there,
> I'm interested in estimating likelihood- (or simply deviance- for GLM) based
> CI. I use the following code, but is there a more efficient way to do it?
>
> obj<-glm(y~x+z....) #fit the full model
> beta.z<-seq(a, b, length=500) #where a<coef(obj)["z"]<b
> out<-list()
> for(i in 1:500){
> out[[i]]<-update(obj,.~.-z+offset(I(beta.z[i]*z)) ) }
> dev.z<-sapply(out, function(x)x$dev) #profile dev for \beta_z
> range(beta.z[(dev.z-obj$dev)<3.8]) #likelihood based CI
>
>
> I understand that there could be some package to do it (for instance in
> MASS???), but I like know the code to use it with some nonstandard
> situations.
Look at how the confint and profile methods for glm in MASS work.
They are similar, but
1) work at glm.fit level
2) use spline interpolation
>
> best,
> vito
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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