RE: [R] Seeing the definition of a function

About this list Date view Thread view Subject view Author view Attachment view

From: Liaw, Andy (andy_liaw@merck.com)
Date: Tue 04 May 2004 - 23:36:25 EST


Message-id: <3A822319EB35174CA3714066D590DCD504AF7CF4@usrymx25.merck.com>

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@agrsci.dk
> Research Centre Foulum, DK-8830 Tjele, Denmark Homepage :
http://www.jbs.agrsci.dk/~sorenh/

______________________________________________
R-help@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

______________________________________________
R-help@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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST