File: methods.R

package info (click to toggle)
multcomp 0.991-2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 548 kB
  • sloc: sh: 43; makefile: 1
file content (30 lines) | stat: -rw-r--r-- 902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

### methods for `glht' objects
coef.glht <- function(object, rhs = FALSE, ...) 
{
    if (rhs) return(object$rhs)
    drop(object$linfct %*% object$coef)
}

vcov.glht <- function(object, ...) 
    object$linfct %*% tcrossprod(object$vcov, object$linfct)

summary.glht <- function(object, test = adjusted(), ...) {
    ts <- test(object)
    object$test <- ts
    class(object) <- c(class(ts), class(object))
    return(object)
}

confint.glht <- function(object, parm, level = 0.95, ...) 
{
    pq <- pqglht(object)
    ci <- pq$qfunction(conf.level = level, ...)
    object$confint <- cbind(pq$coefficients, ci)
    colnames(object$confint) <- c("Estimate", "lwr", "upr")
    attr(object$confint, "conf.level") <- level
    attr(object$confint, "calpha") <- attr(ci, "calpha")
    attr(object$confint, "error") <- attr(ci, "error")
    class(object) <- c("confint.glht", "glht")
    return(object)
}