Dear all, I was trying to see how the function 'confint' is defined. Doing> confintfunction (object, parm, level = 0.95, ...) UseMethod("confint") <environment: namespace:stats> does not really enlighten me. How can I get to see the implementation (I guess it should be possible according to the general philosophy of the R project)? Thanks in advance S??ren ============================================================================================= S??ren H??jsgaard, PhD, Head of Research Unit Phone: +45 8999 1703 Biometry Research Unit, Fax: +45 8999 1300 Danish Institute of Agricultural Sciences E-mail: sorenh at agrsci.dk Research Centre Foulum, DK-8830 Tjele, Denmark Homepage : http://www.jbs.agrsci.dk/~sorenh/
confint is generic so it does nothing but dispatch appropriate methods. If you do methods(confint), you'll see > methods(confint) [1] confint.lm* Non-visible functions are asterisked Typing confint.lm will give you an error because the function is not exported by the stats package namespace. But doing getAnywhere(confint.lm) should do what you want. -roger S??ren H??jsgaard wrote:> Dear all, > I was trying to see how the function 'confint' is defined. Doing > > >>confint > > function (object, parm, level = 0.95, ...) > UseMethod("confint") > <environment: namespace:stats> > > does not really enlighten me. How can I get to see the implementation (I guess it should be possible according to the general philosophy of the R project)? > > Thanks in advance > S??ren > > ============================================================================================= > S??ren H??jsgaard, PhD, Head of Research Unit Phone: +45 8999 1703 > Biometry Research Unit, Fax: +45 8999 1300 > Danish Institute of Agricultural Sciences E-mail: sorenh at agrsci.dk > Research Centre Foulum, DK-8830 Tjele, Denmark Homepage : http://www.jbs.agrsci.dk/~sorenh/ > > ______________________________________________ > 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 >
You _are_ looking at the definition of confint(), which is a generic. What you're probably interested in are the methods, which you can find by:> methods("confint")[1] confint.lm* Non-visible functions are asterisked> getAnywhere("confint.lm")A single object matching 'confint.lm' was found It was found in the following places registered S3 method for confint from namespace stats namespace:stats with value function (object, parm, level = 0.95, ...) { cf <- coef(object) pnames <- names(cf) if (missing(parm)) parm <- seq(along = pnames) else if (is.character(parm)) parm <- match(parm, pnames, nomatch = 0) a <- (1 - level)/2 a <- c(a, 1 - a) pct <- paste(round(100 * a, 1), "%") ci <- array(NA, dim = c(length(parm), 2), dimnames = list(pnames[parm], pct)) ses <- sqrt(diag(vcov(object)))[parm] fac <- qt(a, object$df.residual) ci[] <- cf[parm] + ses %o% fac ci } <environment: namespace:stats> You'll probably want to read a bit about how S3 methods work (e.g., in the White Book). HTH, Andy> From: S??ren H??jsgaard > > Dear all, > I was trying to see how the function 'confint' is defined. Doing > > > confint > function (object, parm, level = 0.95, ...) > UseMethod("confint") > <environment: namespace:stats> > > does not really enlighten me. How can I get to see the > implementation (I guess it should be possible according to > the general philosophy of the R project)? > > Thanks in advance > S??ren > > =============================================================> =============================== > S??ren H??jsgaard, PhD, Head of Research Unit Phone: +45 8999 1703 > Biometry Research Unit, Fax: +45 > 8999 1300 > Danish Institute of Agricultural Sciences E-mail: > sorenh at agrsci.dk > Research Centre Foulum, DK-8830 Tjele, Denmark Homepage :http://www.jbs.agrsci.dk/~sorenh/ ______________________________________________ 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